Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I've created the following three measures to try and assign a percentile to products based on the number of views.
What I'm trying to do is then assign a "bucket" to each of those. For example, products in the 90% to 100% percentiles are called "top 10%". This is my switch statement, created as a calculated column:
This statement returns the expected result if I use in a measure (rather than a column). But I want to be able to use the value to slice the data so that isn't helpful. I also don't understand why.
Grateful for any help or advice here.
When you use a measure inside of a column, you are only going to get the results of that measure for that one row. That is part of what Context Transition is doing. You need to wrap that measure with CALCULATE() and add some REMOVEFILTERS() logic to negate the effects of the context transition. You'll need to play with the REMOVEFILTERS though to find out what has to be cleared. I would ignore the SWITCH for now, and just drop those measures directly in the column and look at the results. Then wrap it with CALCULATE([your measure], REMOVEFILTERS(sometable), REMOVEFITLERS(someothertable[somecolumn0)) until it returns what you want. Then reassemble your SWITCH function.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingUser | Count |
---|---|
42 | |
28 | |
23 | |
18 | |
15 |
User | Count |
---|---|
54 | |
35 | |
18 | |
17 | |
15 |