Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Using Switch to create different Normal Distribution

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:
ND1.PNG

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!

1 ACCEPTED SOLUTION
ChrisMendoza
Resident Rockstar
Resident Rockstar

@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
)

 

 






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

2 REPLIES 2
ChrisMendoza
Resident Rockstar
Resident Rockstar

@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
)

 

 






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Anonymous
Not applicable

Thanks, that did what I wanted it to do.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.