Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
HI Experts
I have teh following DAX measure using a switch function, i want to add userelationship to this measure... not sure if it is possible.
B1 Actuals = VAR SummaryItem = TRIM(SELECTEDVALUE( 'Templates'[Summary 4] )) Return SWITCH(TRUE(), SummaryItem = "U.S.", FORMAT(CALCULATE([Total Revenue], FILTER(Management,Management[Level7] ="TOTAL U.S.")),"$#,##0.0;($#,##0.0)"), SummaryItem = "Canada", FORMAT(CALCULATE([Total Revenue], FILTER(Management,Management[Level6]= "Canada")),"$#,##0.0;($#,##0.0)"), BLANK(),USERELATIONSHIP(Management[Level4],Templates[Summary 4]))
Hi @Anonymous,
There is no any relationship betweent 'Templates' table and 'Management' table, right? In such a scenario, there is no need to use USERELATIONSHIP function in the measure. Please see below:
B1 Actuals = VAR SummaryItem = TRIM(SELECTEDVALUE( 'Templates'[Summary 4] )) Return SWITCH(TRUE(), SummaryItem = "U.S.", FORMAT(CALCULATE([Total Revenue], FILTER(Management,Management[Level7] ="TOTAL U.S.")),"$#,##0.0;($#,##0.0)"), SummaryItem = "Canada", FORMAT(CALCULATE([Total Revenue], FILTER(Management,Management[Level6]= "Canada")),"$#,##0.0;($#,##0.0)"), BLANK())
Best regards,
Yuliana Gu
Hi @Anonymous
USERELATIONSHIP can only be used in functions that take a filter predicate as an argument. See here
If you explain what you are trying to do we can give it a try.
Additionally, what is your intention in using the BLANK() as the last 'value' argument of the SWITCH() ??
Thanks AIB
I am trying to filter the data in the table based on the selections in a filter, i am using a template uploaded from excel in Power BI, currently the template has been added to the data model as a discount table.
So by creating a inactive relationship between template table and the management level table i should be able to filter the data in the table????
@Anonymous
First of all, I do no think the last option with Blank is ever going to execute. You are doing SWITCH(TRUE() and blank is never equal to TRUE.
Regarding USERELATIONSHIP, you use it to temporarily activate an existing inactive relationship.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
95 | |
80 | |
67 | |
62 |
User | Count |
---|---|
146 | |
110 | |
107 | |
86 | |
63 |