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.
Is there a way to to write ALLSELECTED DAX with multiple slicer values where slicers come from different Dim Tables?
Example:
Slicer 1 has Project Name (DimProject[ProjectName])
Slicer 2 has Project Manager (DimTeam[ProjectManager])
Slicer 3 has Calendar Year & Month (DimDate[CalendarYearAndMonth])
I tried the following: CACULATE(SUM(COST), ALLSELECTED(DimProject[ProjectName]), ALLSELECTED(DimTeam[ProjectManager]), ALLSELECTED(DimDate[CalendarYearAndMonth]) )
It didn't work. Can anyone advise on what is the correct way to filter with multiple slicer values [from different tables] while using ALLSELECTED?
Solved! Go to Solution.
Hi @Anonymous ,
According to my understand, you want to sum the cost based on multiple slicer values ,right?
You could use the following formula:
selectionTimes =
VAR _nn =
IF (
ISFILTERED ( 'DimProject'[ProjectName] )
&& MAX ( 'Cost'[ProjectName] ) IN ALLSELECTED ( DimProject[ProjectName] ),
1,
0
)
VAR _mm =
IF (
ISFILTERED ( 'DimTeam'[ProjectManager] )
&& MAX ( 'Cost'[ProjectManager] ) IN ALLSELECTED ( DimTeam[ProjectManager] ),
1,
0
)
VAR _dd =
IF (
ISFILTERED ( 'DimDate'[CalendarYearAndMonth] )
&& MAX ( 'Cost'[CalendarYearAndMonth] )
IN ALLSELECTED ( 'DimDate'[CalendarYearAndMonth] ),
1,
0
)
RETURN
IF ( _mm + _nn + _dd > 0, SUM ( 'Cost'[Cost] ) )
total =
SUMX ( 'Cost', [selectionTimes] )
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Eyelyn Qin
Hi @Anonymous ,
According to my understand, you want to sum the cost based on multiple slicer values ,right?
You could use the following formula:
selectionTimes =
VAR _nn =
IF (
ISFILTERED ( 'DimProject'[ProjectName] )
&& MAX ( 'Cost'[ProjectName] ) IN ALLSELECTED ( DimProject[ProjectName] ),
1,
0
)
VAR _mm =
IF (
ISFILTERED ( 'DimTeam'[ProjectManager] )
&& MAX ( 'Cost'[ProjectManager] ) IN ALLSELECTED ( DimTeam[ProjectManager] ),
1,
0
)
VAR _dd =
IF (
ISFILTERED ( 'DimDate'[CalendarYearAndMonth] )
&& MAX ( 'Cost'[CalendarYearAndMonth] )
IN ALLSELECTED ( 'DimDate'[CalendarYearAndMonth] ),
1,
0
)
RETURN
IF ( _mm + _nn + _dd > 0, SUM ( 'Cost'[Cost] ) )
total =
SUMX ( 'Cost', [selectionTimes] )
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Eyelyn Qin
@Anonymous , This seems correct
try if this can work
CACULATE(SUM(COST), ALLSELECTED(DimProject), ALLSELECTED(DimTeam), ALLSELECTED(DimDate) )
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 |
---|---|
97 | |
96 | |
81 | |
74 | |
66 |
User | Count |
---|---|
126 | |
106 | |
105 | |
86 | |
72 |