Forum Discussion

DaxNewbie's avatar
DaxNewbie
Frequent Visitor
8 years ago
Solved

Calculate() filtered by another measure

Hello,

 

I am trying to filter a calculate() statement with another calculated measure. I have looked at serveral previous questions, but those solutions did not seem to work. Any assistance with my question below or pointing me toward the correct solution in the forum is most appreciated.

 

My dataset has the following structure: 

 

 YearClassClassMovementName
201540John
201640John
201740John
201510Sarah
201621Sarah
201731Sarah
201650Amit 
201750Amit 
201510Nicole
201610Nicole
201721Nicole

 

 

First I created a calculated measure to identify years with no movement (see below). 

 

MoveCalcFilter = CALCULATE(DISTINCTCOUNT(table[Year]), FILTER(table, table[ClassMovement] = 0))

Adding the measure "MoveCalcFilter" to the 'Name' colum results in the following:

 

NameMoveCalcFilter 
John3
Sarah1
Amit2
Nicole2

 

 

Next, I want to used create another calculated measure to count the number of distinct names for which there is a MoveCalcFilter value of three. I tried following calculation, but it resulted in only blank values. 

 

NoMoveCount = CALCULATE(DISTINCTCOUNT(table[Name], FILTER(table,table[MoveCalcFilter] = 3))

The ideal output would yield:

 

ClassNoMoveCount 
41

 

 

Any assistance would be most appreciated. I thank you for your time. Please feel free to reach out if additional information would be helpful.

 

Cheers!

 

  • DaxNewbie

     

    Hi, try with this:

     

    Measure = COUNTX(VALUES(Table2[Name]),IF([MoveCalcFilter]=3,1,BLANK()))

     

    Regards

     

    Victor

3 Replies

  • Vvelarde's avatar
    Vvelarde
    Icon for Community Champion rankCommunity Champion

    DaxNewbie

     

    Hi, try with this:

     

    Measure = COUNTX(VALUES(Table2[Name]),IF([MoveCalcFilter]=3,1,BLANK()))

     

    Regards

     

    Victor

  • Vvelarde's avatar
    Vvelarde
    Icon for Community Champion rankCommunity Champion

    DaxNewbie

     

    Hi, try with this:

     

    Measure = COUNTX(VALUES(Table2[Name]),IF([MoveCalcFilter]=3,1,BLANK()))

     

    Regards

     

    Victor