Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
hi everyone, I need help with a formula that I think should use Switch function.
I have this table (Jerarquia de medidas)
| Level 1 | Level 2 |
| TON | |
| GSV | |
| OFF | Tactic |
| OFF | Manual |
| OFF | Tax |
And I have in my data base, a formula for each measure: a formula for OFF, TON, GSV, Tactic, Manual and Tax.
So I need a formula that brings for each level, the corect formula.
So, I developed this:
Solved! Go to Solution.
Hi @MariaFlorenciaB
Try this
Formula =
VAR KpiList2 = SELECTEDVALUE('Jerarquia Medidas'[Level 2])
VAR KpiList1 = SELECTEDVALUE('Jerarquia Medidas'[Level 1])
RETURN
SWITCH(
KpiList1;
"TON"; [TON];
"GSV"; [GSV Factura];
SWITCH(
KpiList2;
"Manual"; [Manual];
"Tactic"; [TACTICO];
"Tax"; [Tax]
)
)Regards,
Mariusz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MariaFlorenciaB
Try this
Formula =
VAR KpiList2 = SELECTEDVALUE('Jerarquia Medidas'[Level 2])
VAR KpiList1 = SELECTEDVALUE('Jerarquia Medidas'[Level 1])
RETURN
SWITCH(
KpiList1;
"TON"; [TON];
"GSV"; [GSV Factura];
SWITCH(
KpiList2;
"Manual"; [Manual];
"Tactic"; [TACTICO];
"Tax"; [Tax]
)
)Regards,
Mariusz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Mariusz Sorry, I only have one problem:
If I add the line OFF to the formula:
Formula =
VAR KpiList2 = SELECTEDVALUE('Jerarquia Medidas'[Level 2])
VAR KpiList1 = SELECTEDVALUE('Jerarquia Medidas'[Level 1])
RETURN
SWITCH(
KpiList1;
"TON"; [TON];
"GSV"; [GSV Factura];
"OFF"; [OFF];
SWITCH(
KpiList2;
"Manual"; [Manual];
"Tactic"; [TACTICO];
"Tax"; [Tax]
)
)I only see the total number of OFF for the measure OFF and for the measures Manual, Tactic and Tax.
Do you know why this happens?
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 36 | |
| 33 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 72 | |
| 72 | |
| 38 | |
| 35 | |
| 26 |