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
hubnerj
Regular Visitor

Multi Condition Statement to Set a Variable

I am looking to create a variable called DIFF that is set to a specific number based on the value of a text string called STATUS.  Basically - 

If STATUS=Submitted then DIFF=14

or

If STATUS=Active then DIFF=21

or

If STATUS=OnHold then DIFF=28

 

What would be the syntax for this?  Thanks in advance.

2 ACCEPTED SOLUTIONS
Deku
Super User
Super User

Var diff =

Switch( 

Selectedvalue( table[status] ),

"Submitted", 14,

"Active", 21,

"On hold", 28

)

 


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

Worked great, thanks!

View solution in original post

2 REPLIES 2
Deku
Super User
Super User

Var diff =

Switch( 

Selectedvalue( table[status] ),

"Submitted", 14,

"Active", 21,

"On hold", 28

)

 


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Worked great, thanks!

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.