switch statement

Shambhu Rai 1,411 Reputation points
2023-06-18T12:19:45.9033333+00:00

HI Expert,

unable to use switch statement in 2 table in ssas cube

i have used the switch statement but it is not taking columns from more than one table

I created calculated colmun via add new

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
3,066 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,705 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,344 questions
SQL Server | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Sedat SALMAN 14,180 Reputation points MVP
    2023-06-18T14:18:45.3366667+00:00

    After establishing a relationship between the tables, you can use the RELATED function to access the data from the related table.

    SWITCH (
        [Column1], 
        "Value1", RELATED(Table2[Column2]),
        "Value2", RELATED(Table2[Column3]),
        "Other"
    )
    
    

    RELATED function works by following the relationships that you have defined in your data model. If there isn't a direct relationship between the tables, you may need to create one or modify your data model to support the calculations you're trying to perform.

    https://learn.microsoft.com/en-us/dax/related-function-dax


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.