Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

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

  • v-yuta-msft's avatar
    v-yuta-msft
    Icon for Community Support rankCommunity 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's avatar
      Anonymous
      Not applicable

      Hey Yuta, It still doesn't work unfortunately. 

    • Anonymous's avatar
      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"))
      "
      • v-yuta-msft's avatar
        v-yuta-msft
        Icon for Community Support rankCommunity Support

        Anonymous ,

         

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

         

        Regards,

        Jimmy Tao