Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I am quite new to DAX, and I would like to make a Measure that computes different normal distributions based on a string type defined in another column.
Here is the sample table:
Now each type has a different mean and standard deviation I want to put into my calculation, so the Switch statement should look similar to this:
Distribution Value =
SWITCH(
TRUE(),
SUM('Normal Distribution'[Type])="A",
NORM.DIST(SUM('Normal Distribution'[X-Values]),240,100,FALSE()),
SUM('Normal Distribution'[Type])="B",
NORM.DIST(SUM('Normal Distribution'[X-Values]),350,75.6,FALSE()),
SUM('Normal Distribution'[Type])="C",
NORM.DIST(SUM('Normal Distribution'[X-Values]),312,120,FALSE()),
0
)However, I know this is wrong, because you cannot use SUM() with strings, but without using SUM(), I don't know how to access the 'Normal Distribution'[Type] column.
Can anyone take a look? I hope this is quick. Thank you!
Solved! Go to Solution.
@Anonymous -
I do not know what the answers are supposed to be however, using SELECTEDVALUE ( ) seems to not cause an error.
Distribution Value =
SWITCH(
TRUE(),
SELECTEDVALUE('Normal Distribution'[Type])="A",
NORM.DIST(SUM('Normal Distribution'[X-Values]),240,100,FALSE()),
SELECTEDVALUE('Normal Distribution'[Type])="B",
NORM.DIST(SUM('Normal Distribution'[X-Values]),350,75.6,FALSE()),
SELECTEDVALUE('Normal Distribution'[Type])="C",
NORM.DIST(SUM('Normal Distribution'[X-Values]),312,120,FALSE()),
0
)
Proud to be a Super User!
@Anonymous -
I do not know what the answers are supposed to be however, using SELECTEDVALUE ( ) seems to not cause an error.
Distribution Value =
SWITCH(
TRUE(),
SELECTEDVALUE('Normal Distribution'[Type])="A",
NORM.DIST(SUM('Normal Distribution'[X-Values]),240,100,FALSE()),
SELECTEDVALUE('Normal Distribution'[Type])="B",
NORM.DIST(SUM('Normal Distribution'[X-Values]),350,75.6,FALSE()),
SELECTEDVALUE('Normal Distribution'[Type])="C",
NORM.DIST(SUM('Normal Distribution'[X-Values]),312,120,FALSE()),
0
)
Proud to be a Super User!
Thanks, that did what I wanted it to do.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 53 | |
| 42 | |
| 34 | |
| 33 | |
| 21 |
| User | Count |
|---|---|
| 143 | |
| 125 | |
| 100 | |
| 80 | |
| 59 |