Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
if statment is:
if (days<=10,"<10",
if (days >10 && days<=20,"10 to 20",
if (days >20 && days<=30,"20 to 30",
if(days >30 && days<=40,"30 to 40", "morethan 40")
I need to use what if parameter value in the palce of <=10, >10 && <20 etc
if (days<=whatifparameter value,"<10",
if (days > whatifparameter value && days<=whatifparameter value,"10 to 20" (this is should like whatifparameter value to whatifparameter value),
if (days >whatifparameter value && days<=whatifparameter value,"20 to 30"this is should like whatifparameter value to whatifparameter value),
if(days >whatifparameter value && days<=whatifparameter value,"30 to 40 (this is should like whatifparameter value to whatifparameter value), "morethan 40")
could you please help me how to use waht if parameter values in IF or SWITCH statements?
if what if parameter supports in IF or SWITCH statements and alias names as well, then we can change the x axis values dynamically.
Solved! Go to Solution.
Hi @Anonymous ,
You could create measure like below :
measure1 = if (max('Table'[days])<=Parameter1[Parameter1 Value],"<="&""&Parameter1[Parameter1 Value],
if (max('Table'[days]) >Parameter1[Parameter1 Value]&& MAX('Table'[days])<=Parameter2[Parameter2 Value],Parameter1[Parameter1 Value]&"to"&Parameter2[Parameter2 Value],
if (MAX('Table'[days] )>Parameter2[Parameter2 Value] && MAX('Table'[days])<=Parameter3[Parameter3 Value],Parameter2[Parameter2 Value]&"to"&Parameter3[Parameter3 Value],
if(MAX('Table'[days] )>Parameter3[Parameter3 Value]&& MAX('Table'[days])<=Parameter4[Parameter4 Value],Parameter3[Parameter3 Value]&"to"&Parameter4[Parameter4 Value], "morethan"&""&Parameter4[Parameter4 Value]))))
And you will get the below:
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
Hi @Anonymous ,
You could create measure like below :
measure1 = if (max('Table'[days])<=Parameter1[Parameter1 Value],"<="&""&Parameter1[Parameter1 Value],
if (max('Table'[days]) >Parameter1[Parameter1 Value]&& MAX('Table'[days])<=Parameter2[Parameter2 Value],Parameter1[Parameter1 Value]&"to"&Parameter2[Parameter2 Value],
if (MAX('Table'[days] )>Parameter2[Parameter2 Value] && MAX('Table'[days])<=Parameter3[Parameter3 Value],Parameter2[Parameter2 Value]&"to"&Parameter3[Parameter3 Value],
if(MAX('Table'[days] )>Parameter3[Parameter3 Value]&& MAX('Table'[days])<=Parameter4[Parameter4 Value],Parameter3[Parameter3 Value]&"to"&Parameter4[Parameter4 Value], "morethan"&""&Parameter4[Parameter4 Value]))))
And you will get the below:
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
@Anonymous , if plan to create axis/column, it will not work
Assume you have whatif parameter with name param, but this not what you need
new measure =
Switch(True() ,
selectedvalue(param[value]) <= 10 " < 10",
selectedvalue(param[value]) <= 20 " 10 -20 ",
selectedvalue(param[value]) <= 30 " 20 -30 ",
selectedvalue(param[value]) <= 40 " 30 -40 ",
" > 40"
)
But you need axis /column on the measure, you need dynamic segmentation
Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1387187#M626
Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
115 | |
112 | |
105 | |
95 | |
58 |
User | Count |
---|---|
174 | |
147 | |
136 | |
102 | |
82 |