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.
I am migrating a Spotfire Report to a PowerBI Report. For one of the columns, I have a Spotfire case when query that I want to convert to a switch case DAX Expression. I started out and I think I am good with the initial part of the query but am not sure how to build the rest of the query. Here are the details:
Spotfire case when query:
CASE WHEN (
[RefPointGroupCap] is not null) OR (
[MortgageGroupCap] is not null) OR (
[MPBGroupCap] is not null) OR (
[NCBGroupCap] is not null) OR (
[SRCGroupCap] is not null) THEN
"Y"
& (if([RefPointGroupCap] is null,""," / " & [RefPointGroupCap]))
& (If([MortgageGroupCap] is null,""," / " & [MortgageGroupCap]))
& (If([MPBGroupCap] is null,""," / " & [MPBGroupCap]))
& (If([NCBGroupCap] is null,""," / " & [NCBGroupCap]))
& (If([SRCGroupCap] is null,""," / " & [SRCGroupCap]))
WHEN (
[RefPointGroupCap] is null) and (
[MortgageGroupCap] is null) and (
[MPBGroupCap] is null) and (
[NCBGroupCap] is null) and (
[SRCGroupCap] is null) THEN "N"
END
The switch case query I built half way:
Column=
SWITCH (
TRUE (),
NOT(ISBLANK('F22_New_Cumulative_export (2)'[RefPointGroupCap])) ||
NOT(ISBLANK('F22_New_Cumulative_export (2)'[MortgageGroupCap])) ||
NOT(ISBLANK('F22_New_Cumulative_export (2)'[MPBGroupCap])) ||
NOT(ISBLANK('F22_New_Cumulative_export (2)'[NCBGroupCap])) ||
NOT(ISBLANK('F22_New_Cumulative_export (2)'[SRCGroupCap])) ,
"Y" &&
(IF(ISBLANK('F22_New_Cumulative_export (2)'[RefPointGroupCap]), BLANK(), " / " & 'F22_New_Cumulative_export (2)'[RefPointGroupCap]) &&
(IF(ISBLANK('F22_New_Cumulative_export (2)'[MortgageGroupCap]), BLANK(), " / " & 'F22_New_Cumulative_export (2)'[MortgageGroupCap]) &&
(IF(ISBLANK('F22_New_Cumulative_export (2)'[MPBGroupCap]), BLANK(), " / " & 'F22_New_Cumulative_export (2)'[MPBGroupCap]) &&
(IF(ISBLANK('F22_New_Cumulative_export (2)'[NCBGroupCap]), BLANK(), " / " & 'F22_New_Cumulative_export (2)'[NCBGroupCap]) &&
(IF(ISBLANK('F22_New_Cumulative_export (2)'[SRCGroupCap]), BLANK(), " / " & 'F22_New_Cumulative_export (2)'[SRCGroupCap]),
ISBLANK('F22_New_Cumulative_export (2)'[RefPointGroupCap]) ||
ISBLANK('F22_New_Cumulative_export (2)'[MortgageGroupCap]) ||
ISBLANK('F22_New_Cumulative_export (2)'[MPBGroupCap]) ||
ISBLANK('F22_New_Cumulative_export (2)'[NCBGroupCap]) ||
ISBLANK('F22_New_Cumulative_export (2)'[SRCGroupCap]),
"N"
))))))
Let me know if you need any more information, thanks for the help!
Please have a try.
Create a column.
IF(F22_New_Cumulative_export (2)'[RefPointGroupCap]=BLANK()||
'F22_New_Cumulative_export (2)'[MortgageGroupCap]=BLANK() ||
'F22_New_Cumulative_export (2)'[MPBGroupCap]=BLANK() ||
'F22_New_Cumulative_export (2)'[NCBGroupCap]=BLANK() ||
'F22_New_Cumulative_export (2)'[SRCGroupCap]=BLANK() ,
"Y" ,
IF([RefPointGroupCap]=BIANK()&&
[MortgageGroupCap]=BLANK()&&
[MPBGroupCap]=BLANK()&&
[NCBGroupCap]=BLANK()&&
[SRCGroupCap]=BLANK(),
"N",
"OTHER"))
I do not understand the logic of this paragraph. Could you please explain it to me?
[SRCGroupCap] is not null) THEN
"Y"
& (if([RefPointGroupCap] is null,""," / " & [RefPointGroupCap]))
& (If([MortgageGroupCap] is null,""," / " & [MortgageGroupCap]))
& (If([MPBGroupCap] is null,""," / " & [MPBGroupCap]))
& (If([NCBGroupCap] is null,""," / " & [NCBGroupCap]))
& (If([SRCGroupCap] is null,""," / " & [SRCGroupCap]))
Does it mean if [SRCGroupCap] is not equal to blank, then output "Y", If [SRCGroupCap] equals to blank,then output blank, otherwise output itself? Is this more redundant?
If you don't write this step, the blank part is still blank, and the part with values still has values.
If I have misunderstood your meaning, please provide more details with your desired output.
How to Get Your Question Answered Quickly
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
41 | |
19 | |
19 | |
16 | |
15 |
User | Count |
---|---|
49 | |
26 | |
22 | |
17 | |
16 |