March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I am currently converting a Tableau report over to Power BI and came across a dashboard that needs to have a parameter slicer that gives the option to exclude different percentages of rows based on the longest days of service. This gives the user the option to find averages based on the bottom 85% of days of service, but still leaves the option to calculate the averages based on all of the rows as well. I've tried to rework it in Power BI, but I'm having trouble allowing the percent excluded to remove rows when changed (excluding the rows where days of service are the longest) rather than multiply the individual Days of Service by a percentage. I was wondering what sort of DAX or M code would allow me to create either a measure or calculated column to allow for this?
Thanks!
Solved! Go to Solution.
Hi @mmcarthur ,
According to your description, I create a sample.
Here's my solution, create a parameter.
Then create a measure,
Average =
AVERAGEX (
TOPN (
'Parameter'[Parameter Value] * COUNTROWS ( ALL ( 'Table' ) ),
'Table',
'Table'[Days of Service], ASC
),
'Table'[Days of Service]
)
Put the measure in a card visual, get dynamic average value based on the parameter slicer.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @mmcarthur ,
According to your description, I create a sample.
Here's my solution, create a parameter.
Then create a measure,
Average =
AVERAGEX (
TOPN (
'Parameter'[Parameter Value] * COUNTROWS ( ALL ( 'Table' ) ),
'Table',
'Table'[Days of Service], ASC
),
'Table'[Days of Service]
)
Put the measure in a card visual, get dynamic average value based on the parameter slicer.
I attach my sample below for your reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I tried this DAX equation and everything works except the data does not change when the parameter slicer value gets changed. Any thoughts on what I could be missing to cause this to happen?
Hi @mmcarthur ,
Do you use the What if parameter under the Modeling ribbon, and then reference the 'Parameter'[Parameter Value] in the measure(not a calculated column)?
Best Regards,
Community Support Team _ kalyj
@mmcarthur Likely you would want to use the TOPN function in a measure. TOPN function (DAX) - DAX | Microsoft Docs
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |