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

Filter and selected all

Hey there,

 

Right now Im stuck with an issue, we have a slicer with a "selected all" function, but my measure calculation wont work with it and shows either blank or a random value.

 

Selected year = IF(AND(ISFILTERED(NavOmsGrupper[gruppe]);ISFILTERED('Calendar'[Year])); CALCULATE(SUM(FinansTransaktioner[Belob])); IF(ISFILTERED('Calendar'[Year]); CALCULATE(SUM(FinansTransaktioner[Belob]);FILTER(ResourceGrupper;ResourceGrupper[Resource Gruppe (groups)])); "select a year"))
 
With the first part of the code, we secure that the user of the report select a year, but we also want to be able to select all groups with one click, but since that doesnt work in DAX, we have decided to try another solution.
 
So if nothing is selected in the group slicer, the calculation should show a total of all groups.
 
 
5 REPLIES 5
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 


With the first part of the code, we secure that the user of the report select a year, but we also want to be able to select all groups with one click, but since that doesnt work in DAX, we have decided to try another solution.
 
So if nothing is selected in the group slicer, the calculation should show a total of all groups.

Try modify the measure as below and check if it works:

Selected year =
IF (
    AND ( HASONEVALUE ( NavOmsGrupper[gruppe] ); HASONEVALUE ( 'Calendar'[Year] ) );
    CALCULATE ( SUM ( FinansTransaktioner[Belob] ) );
    IF (
        ISFILTERED ( 'Calendar'[Year] );
        CALCULATE (
            SUM ( FinansTransaktioner[Belob] );
            FILTER ( ResourceGrupper; ResourceGrupper[Resource Gruppe (groups)] )
        );
        "select a year"
    )
)

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

I modified it a little, I get a result, but it dosnt make sence, so if you have any solution it would be great.

 

"

Selected year = IF
( AND
( HASONEVALUE ( NavOmsGrupper[gruppe] ); HASONEVALUE ( 'Calendar'[Year] ) ); CALCULATE ( SUM ( FinansTransaktioner[Belob])); IF(HASONEVALUE('Calendar'[Year]); CALCULATE(SUM(FinansTransaktioner[Belob]);ALL(NavOmsGrupper[gruppe])); "Select year"))
"

@Anonymous ,

 

Could you please share some sample data and clairfy more details about your requirement?

 

Regards,

Jimmy Tao

Anonymous
Not applicable

Hey Yuta, It still doesn't work unfortunately. 

Greg_Deckler
Super User
Super User

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Not really enough information in your post to tell what is happening.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors