Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Hello everyone,
I am a novice user in power bi, slowly upgrading myself to multiple scenarios, have recently came across a situation to resolve the output by random change in the rate value passed through a parameter. The issue over here is I have written a switch dax function and applied the logic, however, it gives me output as zero.
Is there any other work around to get the desired results in the "dynamic_bin_column" ? I am attaching the document as well for the solution, please provide a direction/guidance.
Thanks everyone for your valuable time & effort !!
@PhilipTreacy, @parry2k @AlexPowers
Solved! Go to Solution.
There @Syndicate_Admin@kxj54590
Download this PBIX file with code shown below
This calculation should be done with a Measure rather than a Column. Here's the DAX for the Measure
dynamic_bin_measure = SWITCH (
TRUE,
Dyn_Rate[Dyn_Rate Value] = 0, 0,
Dyn_Rate[Dyn_Rate Value] <= SELECTEDVALUE(Input[2 Tier Range]) , 1,
Dyn_Rate[Dyn_Rate Value] > SELECTEDVALUE(Input[2 Tier Range]) && Dyn_Rate[Dyn_Rate Value] <= SELECTEDVALUE(Input[3 Tier Range]), 2,
Dyn_Rate[Dyn_Rate Value] > SELECTEDVALUE(Input[3 Tier Range]) && Dyn_Rate[Dyn_Rate Value] <= SELECTEDVALUE(Input[4 Tier Range]), 3,
Dyn_Rate[Dyn_Rate Value] > SELECTEDVALUE(Input[4 Tier Range]) && Dyn_Rate[Dyn_Rate Value] <= SELECTEDVALUE(Input[5 Tier Range]), 4,
Dyn_Rate[Dyn_Rate Value] > SELECTEDVALUE(Input[5 Tier Range]), 5,
0
)
However there is another problem. You are testing for values of [Dyn_Rate Value] which can be anything from 0 to 100. But all of the Tier values are between 0 and 1 so as soon as [Dyn_Rate Value] is greater than 0, all of your dynamic bin values will be 5.
You either need to adjust the Tier values, or adjust the values that [Dyn_Rate Value] can take, or divide [Dyn_Rate Value] by 100 to make it always be between 0 and 1.0.
In the file above I've divided [Dyn_Rate Value] by 100.
Regards
Phil
There @Syndicate_Admin@kxj54590
Download this PBIX file with code shown below
This calculation should be done with a Measure rather than a Column. Here's the DAX for the Measure
dynamic_bin_measure = SWITCH (
TRUE,
Dyn_Rate[Dyn_Rate Value] = 0, 0,
Dyn_Rate[Dyn_Rate Value] <= SELECTEDVALUE(Input[2 Tier Range]) , 1,
Dyn_Rate[Dyn_Rate Value] > SELECTEDVALUE(Input[2 Tier Range]) && Dyn_Rate[Dyn_Rate Value] <= SELECTEDVALUE(Input[3 Tier Range]), 2,
Dyn_Rate[Dyn_Rate Value] > SELECTEDVALUE(Input[3 Tier Range]) && Dyn_Rate[Dyn_Rate Value] <= SELECTEDVALUE(Input[4 Tier Range]), 3,
Dyn_Rate[Dyn_Rate Value] > SELECTEDVALUE(Input[4 Tier Range]) && Dyn_Rate[Dyn_Rate Value] <= SELECTEDVALUE(Input[5 Tier Range]), 4,
Dyn_Rate[Dyn_Rate Value] > SELECTEDVALUE(Input[5 Tier Range]), 5,
0
)
However there is another problem. You are testing for values of [Dyn_Rate Value] which can be anything from 0 to 100. But all of the Tier values are between 0 and 1 so as soon as [Dyn_Rate Value] is greater than 0, all of your dynamic bin values will be 5.
You either need to adjust the Tier values, or adjust the values that [Dyn_Rate Value] can take, or divide [Dyn_Rate Value] by 100 to make it always be between 0 and 1.0.
In the file above I've divided [Dyn_Rate Value] by 100.
Regards
Phil
@Syndicate_Admin@philiptreacy: Quick question, the way you have explained the scenario is outstanding and has given me the desired output. However, I am thinking into more advance scenario where i have it for multiple parameters. The current pbix has got single paramter passed across multuple product names. However, as i am thinking out loud, what if i pass each paramter rate value per product name/product ID. The reason behind thinking this kind of approach is because each product name/product ID has got disparate tier range values. So, if a user wants to punch in each rate, to each product, How can that be achieved dynamically ? Is there any possible option to solve this scenario ?
I am excited to look forward to your thoughts/solution.
Thanks
Kxj
@Syndicate_Admin : Excellent, thanks for the work around. I really feel good in this community by solving problems. I hope one day i can give back the same. 🙂
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
88 | |
77 | |
57 | |
40 | |
39 |
User | Count |
---|---|
117 | |
83 | |
79 | |
48 | |
42 |