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.
Hi guys, I have a question has anybody an idea how to let users enter thresholds as a slicer. I know this has to be done by adding a variable but I dont know how to do that. I put the link to to the file. So if I have shipping dates and and categories and the users tells me they want to be able to set their own thresholds for how long a difference in shipping date and arriving date is accepted how do I go about that? So the user should be able to say it is ok if a delivery takes 30 days but more than is a problem or 20 days . So how can I set a variable x, y in power bi and let the user insert the number they want ? A second question is that I have to create a categorization afterwards that based on the threshold if there is a 10percent delay is should be called " Acceptable" or 50% delay of the threshold, then it should be " Over threshold" but how can I set up the percentage that is accepted based on the threshold? Maaaany thanks! https://github.com/userdata21/file/blob/master/variable_question.pbix
Solved! Go to Solution.
Hi @userdata
Create two what-if paramter as link i post above
create them using UI, then you will get formual below automcatically.
Threshold = GENERATESERIES(0, 50, 1)
Pencentage = GENERATESERIES(0, 1, 0.0010)
Create measures
Measure = IF(MAX([datediff day])<=[Threshold Value],"not delay","delay")
Measure 2 = var p=(MAX([datediff day])-[Threshold Value])/[Threshold Value] return IF([Measure]="delay",IF(p<=[Pencentage Value],"accepted delay","over threshold"))
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks so much @v-juanli-msft !! You are a heroo!!
I tried to do some calculations without the what if flter but by creating the same formula by having a table where I used generateseries but the calculations do not work only with the generateseries dax. It has to be set as a parameter to work. Do you maybe know why that is not calculating it right?
Hi @userdata
Create two what-if paramter as link i post above
create them using UI, then you will get formual below automcatically.
Threshold = GENERATESERIES(0, 50, 1)
Pencentage = GENERATESERIES(0, 1, 0.0010)
Create measures
Measure = IF(MAX([datediff day])<=[Threshold Value],"not delay","delay")
Measure 2 = var p=(MAX([datediff day])-[Threshold Value])/[Threshold Value] return IF([Measure]="delay",IF(p<=[Pencentage Value],"accepted delay","over threshold"))
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @userdata
Please use what-if parameter to create a slicer which can let users enter numbers.
https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-what-if
Best Regards
Maggie
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
71 | |
37 | |
31 | |
27 |
User | Count |
---|---|
91 | |
49 | |
45 | |
38 | |
36 |