Forum Discussion

JustinDoh1's avatar
JustinDoh1
Post Prodigy
5 years ago
Solved

My calculation does not work using variable (row context issue or something else?)

I am sharing my Pbix file here.       I posted a similar question yesterday, but this is little bit different (because I am trying to see whether somehow my logic has an error: ex "vNotElig...
  • PaulDBrown's avatar
    PaulDBrown
    5 years ago

    How about this for the variable:

     

    Var vNotEligibleStep1 = 
        COUNTROWS(
            FILTER(
                Data,
                Data[Consent] = "Not Eligible"  &&
                Data[Step] = 1
            )
        )

     

     

    This will return 1 for each row which meets the filtered criteria. You can now keep the switch function clause.

  • PaulDBrown's avatar
    PaulDBrown
    5 years ago

    Alternatively you can try:

    new measure = SUMX(Data, [Step 1_0819])