Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance 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 ReportingCheck out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |