The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 |
---|---|
26 | |
12 | |
8 | |
8 | |
5 |
User | Count |
---|---|
30 | |
15 | |
12 | |
12 | |
7 |