Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi everyone,
i'm trying to bring this query
CASE sum(ANAR.SFRIDO)
when 0 then sum(Vendite.Cost)
else sum(Vendite.Cost+Vendite.Cost*ANAR.SFRIDO/100)
end
Vendite and ANAR are the table. Cost and SFRIDO are the columns
I understood that i have to use SWITCH but i don't understand how to put togethere switch with sum and arithmetic operators of the original query. How can i transform this query that come from sql server to power bi?
Thank you a lot !
Solved! Go to Solution.
Measure_Name =
Var _SFRIDO = SUM(ANAR[SFRIDO])
Var _COST = SUM(Vendite[Cost])
return
IF(_SFRIDO = 0, _COST, _COST +_COST * _SFRIDO / 100
Please optimize the measure.
Measure_Name =
Var _switchValue = SUM(ANAR[SFRIDO])
return
IF(_switchValue = 0, SUM(Vendite[Cost]), Vendite[Cost]) + MAX(Vendite[Cost]) * _SFRIDO / 100
Sorry, I had written the wrong table name by writing “max” but it was wrong, now I removed it and wrote the correct table name i.e. “Sales”. Why do you use the MAX function? Thank you
Measure_Name =
Var _SFRIDO = SUM(ANAR[SFRIDO])
Var _COST = SUM(Vendite[Cost])
return
IF(_SFRIDO = 0, _COST, _COST +_COST * _SFRIDO / 100
Thank you, it seems working.
What about this other query? I don' t understand how to arrasnge this one. Can you help me?
SQL SERVER:
sum(CASE WHEN anama.ppcoll is null
THEN 0
ELSE
case when anama.ppcoll <> 0
then Vendite."Quantità"/ anama.ppcoll
else 0
end
END)
Thanks!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 46 | |
| 43 | |
| 39 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 68 | |
| 31 | |
| 27 | |
| 24 |