Forum Discussion

AndresSalomon's avatar
AndresSalomon
Icon for Helper II rankHelper II
8 years ago
Solved

Perform a measure when a filter is active

Hi all, it has been a while without doubts (it seems I'm learning and is because of the people here, thanks!!), but now I come with a doubt that I'm not being able to find a solution. Is something pr...
  • Abduvali's avatar
    8 years ago

    Hi AndresSalomon,

     

    Try creating a column with IF statement:

     

    Condition = IF(Table[Type] = "Payroll", 1,0)

     

    and 

     

    Global Measure = 

    Var M1 = measure1

    Var M2 = measure2

     

     

     

     

    Return

     

    if(table[condition]>0,M1,if(table[condition]=0,M2,0) //if you calculating on different columns then it will be blank anyway

     

     

     

     

     

    This might do a trick for you.

     

    Regards

    Abduvali

  • Anonymous's avatar
    Anonymous
    8 years ago

    AndresSalomon,

    Create the condition column as Abduvali's post in the dimension table, and create the global measure using dax below in the dimension table. You will get expected result when using dimtype slicer  to filter your visual.

    Global Measure =  
    Var M1 = [Measure 1]
    Var M2 = [Measure 2]
    Return
    if(MAX('dimension'[Condition])>0,M1,if(MAX('dimension'[Condition])=0,M2,0))



    Regards,
    Lydia