Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Cannot override Page Filter in Measure

Hello,

 

I have a ProjectID Page Filter applied so that all measures and graphs only report from ProjectID = 018CAD.

There is only one measure I would like to measure the Total Hours across all the ProjectID values.

I am using the CALCULATE function along with the ALL for the Filter but for some reason it seems that it is not working.

 

Can you help me to understand where is the error in my measure, please?

Thank you

 

Duration Total Hours Auditing Time AsString = 
// Overrides all Page Filters
VAR TotalHours = (SUM(Toggl[DurationTotalMinutes])/60)
VAR TotalMinutes = (SUM(Toggl[DurationTotalMinutes]))
VAR FinalResult = if(ISBLANK(TotalHours),"0",if(TotalHours<0,(TotalMinutes & " m"),Round(TotalHours,0)) & " h")
Return
CALCULATE(FinalResult,ALL(Toggl[ProjectID]))

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    I have a test on my side, please modify your measure:

    Duration Total Hours Auditing Time AsString = 
    
    //override page filter at first
    VAR TotalMinutes = CALCULATE( SUM(Toggl[DurationTotalMinutes]),ALL(Toggl))
    
    VAR TotalHours =TotalMinutes/60
    return  if(ISBLANK(TotalHours),"0",if(TotalHours<0,(TotalMinutes & " m"),Round(TotalHours,0)) & " h")

    Output:


    Best Regards,
    Eyelyn Qin
    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
    4 years ago

    Hi Anonymous ,

     

    To my knowledge, It's not possible to override page-filter but keep filter in slicer since the filters has priority.

    My workaround is to create a slicer for ProjectID instead of apply it to page-filter. And then select the interaction type as "None":

     

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

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    I have a test on my side, please modify your measure:

    Duration Total Hours Auditing Time AsString = 
    
    //override page filter at first
    VAR TotalMinutes = CALCULATE( SUM(Toggl[DurationTotalMinutes]),ALL(Toggl))
    
    VAR TotalHours =TotalMinutes/60
    return  if(ISBLANK(TotalHours),"0",if(TotalHours<0,(TotalMinutes & " m"),Round(TotalHours,0)) & " h")

    Output:


    Best Regards,
    Eyelyn Qin
    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

      This worked beatifully, Anonymous . Thank you.

      I think I understand what you did. You remove the filter on the first calculation rather than on the Return expression. Learned something new today, thank you.

       

      I only realised now that my question was not exactly what I needed as I would still like to keep that measure to react to the date slicer. Would this be an easy tweak to the code, you reckon?

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    To my knowledge, It's not possible to override page-filter but keep filter in slicer since the filters has priority.

    My workaround is to create a slicer for ProjectID instead of apply it to page-filter. And then select the interaction type as "None":

     

    Best Regards,
    Eyelyn Qin
    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

    it did not work 😞

    tried both REMOVEFILTERS() and REMOVEFILTERS(ProjectID)

     

    CALCULATE(FinalResult,REMOVEFILTERS(Toggl[ProjectID]))