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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Andy_W
New Member

Newbie trying to convert SSRS report functionality to Power BI

Hi,

I just got my hands on Power BI and now trying get some functionality from SSRS to Power BI... And I'm a newbie in both Smiley Very Happy 

 

Is this, or even part of it, possible with Dax or something else in Power BI?

=Switch(
Fields!Category.Value="C",Fields!RevenueWithProbability.Value, Fields!Category.Value="B",Fields!Revenue.Value, Fields!Category.Value="D",Fields!Revenue.Value, Fields!Yearmonth.Value<=Parameters!InvoiceMonth.Value,Fields!InvoicedAmount.Value, Fields!Yearmonth.Value>Parameters!InvoiceMonth.Value,Fields!EstimatedValue.Value)

I've tried different variations of Switch and If without luck so far. Any suggestions, except get some beer and forget it? Smiley LOL

 

noidea.jpg

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @Andy_W,

 

In Power BI, we can create a calculated column, then specify DAX expression with Switch() function to return corresponding value based on the condition like below:

 

Column = SWITCH(TRUE(),Table1[value]>60,"Green",Table1[value]<=60, "Red")

 

q1.PNG

 

SWITCH Function (DAX)

DAX – Making the “Case” for SWITCH()

 

In addition, in Power BI, Query Parameter is available, but we are not able to use reference the query parameter in DAX expression like in SSRS. Regarding query parameter, please see this article: Deep Dive into Query Parameters and Power BI Templates.

 

If you have any question, please feel free to ask.

 

Best Regards,
Qiuyun Yu

 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-qiuyu-msft
Community Support
Community Support

Hi @Andy_W,

 

In Power BI, we can create a calculated column, then specify DAX expression with Switch() function to return corresponding value based on the condition like below:

 

Column = SWITCH(TRUE(),Table1[value]>60,"Green",Table1[value]<=60, "Red")

 

q1.PNG

 

SWITCH Function (DAX)

DAX – Making the “Case” for SWITCH()

 

In addition, in Power BI, Query Parameter is available, but we are not able to use reference the query parameter in DAX expression like in SSRS. Regarding query parameter, please see this article: Deep Dive into Query Parameters and Power BI Templates.

 

If you have any question, please feel free to ask.

 

Best Regards,
Qiuyun Yu

 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ankitpatira
Community Champion
Community Champion

@Andy_W In power bi desktop go to query editor and under Transform tab you can use Replace Values option which lets you do similar to Swith or Case statement.

 

Capture.PNG

 

 

 

 

 

 

 

 

 

@ankitpatira Thanks! Not quite sure yet how to use Replace Values option similarly like SSRS does with that script dynamically, but I will look into that.  

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.