Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Multiple Slicers from Different DIM TABLES with Multiple ALLSELECTED DAX statements

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?

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

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] )

10.12.multi.gif

 

Here is my pbix file.

 

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

View solution in original post

2 REPLIES 2
v-eqin-msft
Community Support
Community Support

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] )

10.12.multi.gif

 

Here is my pbix file.

 

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

amitchandak
Super User
Super User

@Anonymous , This seems correct

 

try if this can work

 

CACULATE(SUM(COST), ALLSELECTED(DimProject), ALLSELECTED(DimTeam), ALLSELECTED(DimDate) )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.