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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.