We'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 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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 38 | |
| 33 | |
| 17 | |
| 17 |
| User | Count |
|---|---|
| 67 | |
| 62 | |
| 38 | |
| 34 | |
| 22 |