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.
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
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?
Solved! Go to Solution.
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")
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
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")
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
@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.
@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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
89 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |