Forum Discussion
My calculation does not work using variable (row context issue or something else?)
- 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.
- 5 years ago
Alternatively you can try:
new measure = SUMX(Data, [Step 1_0819])
Anonymous Thank you for response. I would like to follow up if you could help me with any suggestions regards to how to fix the row context issue I am having. (BTW, I added "Tina Turner" in the Pbix file. Sorry I like oldies. 🙂 )
- PaulDBrown5 years agoCommunity Champion
I see you've changed the measure, since this step was always going to return 1
Now the rogue variable returns a date, (specifically the MAX(Data[consentdate])based on the filters) but the first clause in the switch function checks to see if the variable returns 1 (a whole number; not a date). So I would assume the result is always false, since a date is never "1"...
- JustinDoh15 years agoPost Prodigy
PaulDBrown Thank you for your help. Yea. I was modifying the original file as I put [ConsentDate] instead of [Consent]. I was/am trying to create a logic "exists".
I guess " = 1" was silly. Here is what I am trying to say: If on the Row context level, if this particular row meets this condition (Step =1 & Consent = "Not Eligible"), result should be "".
- PaulDBrown5 years agoCommunity Champion
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.