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 there,
I have a task where i have to calculate electrical tariff. However i cant get pass through getting the DAX codes right for the conditional calculation, i would appreciate some help.
What i want to achieve is:
1. If total consumption is below 200 kwh, the total consumption will be multiplied by 0.435
2. If the total consumption is more than 200 kwh,
The first 200kwh will be multiplied by 0.435 and value over 200kwh will be multiplied by 0.509
Solved! Go to Solution.
Assuming you have an existing measure for [Total Consumption] I think the following works:
Electrical Tariff =
VAR TotalConsumption = [Total Consumption]
VAR Result =
IF (
TotalConsumption <= 200,
TotalConsumption * 0.435,
(200 * 0.435) + (TotalConsumption - 200)*0.509
)
RETURN Result
Thank you so much, works well for me !
Assuming you have an existing measure for [Total Consumption] I think the following works:
Electrical Tariff =
VAR TotalConsumption = [Total Consumption]
VAR Result =
IF (
TotalConsumption <= 200,
TotalConsumption * 0.435,
(200 * 0.435) + (TotalConsumption - 200)*0.509
)
RETURN Result
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 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 65 | |
| 31 | |
| 28 | |
| 24 |