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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. 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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.