Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
I want to filter one table based on mulitple thresholds. See examples below:
Data table:
Expense amount Category
250 Airline
500 Airline
150 Airline
300 Entertainment
1000 Entertainment
Right now i have one parameter, that for example, i can enter in 200 in a slicer, and the table will update to show me expenses that are over $200. Filtered view below:
Expense amount Category
250 Airline
500 Airline
300 Entertainment
1000 Entertainment
What i want to be able to do is to have thresholds, that the user can update directly through a slicer on the page, for each expense category.
For example, I want to only show airline expenses over $200, and entertainment expenses only over $500. Below is what the result would be:
Expense amount Category
250 Airline
500 Airline
1000 Entertainment
Does anyone know how to do this? Any help is appreciated. Thank you!
Solved! Go to Solution.
Hi, @daosborne
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Data:
AirExpense1(a calculated table):
AirExpense1 = GENERATESERIES(1,MAX(Data[Expense amount]),1)
EntertainmentExpense2(a calculated table):
EntertainmentExpense2 = GENERATESERIES(1,MAX(Data[Expense amount]),1)
You may create a measure like below.
Visual Control =
var _category = SELECTEDVALUE(Data[Category])
var _expense = SELECTEDVALUE(Data[Expense amount])
return
IF(
ISFILTERED(Category[Category]),
IF(
HASONEVALUE(Category[Category]),
IF(
SELECTEDVALUE(Category[Category]) = "Airline"&&HASONEVALUE(AirExpense1[Value])&&_category="Airline"&&_expense>=SELECTEDVALUE(AirExpense1[Value]),
1,
IF(
SELECTEDVALUE(Category[Category])="Entertainment"&&HASONEVALUE(EntertainmentExpense2[Value])&&_category="Entertainment"&&_expense>=SELECTEDVALUE(EntertainmentExpense2[Value]),
1,0
)
),
IF(
OR(
_category="Airline"&&_expense>=SELECTEDVALUE(AirExpense1[Value]),
_category="Entertainment"&&_expense>=SELECTEDVALUE(EntertainmentExpense2[Value])
)&&SELECTEDVALUE(AirExpense1[Value])<>BLANK()&&SELECTEDVALUE(EntertainmentExpense2[Value])<>BLANK(),
1,0
)
),
1
)
Finally you may put the measure 'Visual control' in the corresponding visual level filter to display the result.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @daosborne
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Data:
AirExpense1(a calculated table):
AirExpense1 = GENERATESERIES(1,MAX(Data[Expense amount]),1)
EntertainmentExpense2(a calculated table):
EntertainmentExpense2 = GENERATESERIES(1,MAX(Data[Expense amount]),1)
You may create a measure like below.
Visual Control =
var _category = SELECTEDVALUE(Data[Category])
var _expense = SELECTEDVALUE(Data[Expense amount])
return
IF(
ISFILTERED(Category[Category]),
IF(
HASONEVALUE(Category[Category]),
IF(
SELECTEDVALUE(Category[Category]) = "Airline"&&HASONEVALUE(AirExpense1[Value])&&_category="Airline"&&_expense>=SELECTEDVALUE(AirExpense1[Value]),
1,
IF(
SELECTEDVALUE(Category[Category])="Entertainment"&&HASONEVALUE(EntertainmentExpense2[Value])&&_category="Entertainment"&&_expense>=SELECTEDVALUE(EntertainmentExpense2[Value]),
1,0
)
),
IF(
OR(
_category="Airline"&&_expense>=SELECTEDVALUE(AirExpense1[Value]),
_category="Entertainment"&&_expense>=SELECTEDVALUE(EntertainmentExpense2[Value])
)&&SELECTEDVALUE(AirExpense1[Value])<>BLANK()&&SELECTEDVALUE(EntertainmentExpense2[Value])<>BLANK(),
1,0
)
),
1
)
Finally you may put the measure 'Visual control' in the corresponding visual level filter to display the result.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@daosborne , what if parameter should help you
https://docs.microsoft.com/en-us/power-bi/desktop-what-if
Also, refer Segmentation
https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 56 | |
| 40 | |
| 35 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 38 | |
| 35 | |
| 23 |