cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JessVinsteen
Helper I
Helper I

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

@JessVinsteen ,

 


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.

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

@JessVinsteen ,

 

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

 

Regards,

Jimmy Tao

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!!!
Check out my External Tool for Power BI Desktop! Microsoft Hates Greg's Quick Measures
YouTube Channel! Microsoft Hates Greg
Check out my latest book!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.