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 want to create a charge amount based on a tiered rate structure. I found a model out there created by Victor Acquach (if you are still out there I would love to see your response) and built my model just like what he had in his. With some stuggle I am now getting a total charge but it is only going through the first tier to calculate. Here is the tiered rates that I am workin with for my example.
Type | Usage Band | Usage From | Usage To | Rate | Date From | Date To | $Amount | |
COMM | 1 to 6 | 0 | 600 | 4.60 | 5/1/2016 | 4/30/2017 | - | the first 600 units |
COMM | 7 to 50 | 600 | 5000 | 5.09 | 5/1/2016 | 4/30/2017 | 27.60 | next 4400 units |
COMM | 51 to 951 | 5000 | 99500 | 4.29 | 5/1/2016 | 4/30/2017 | 223.96 | next 94500 units |
COMM | > 1000 | 99500 | 999999 | 3.03 | 5/1/2016 | 4/30/2017 | 4,054.05 | over 1,000,000 |
COMM | 1 to 6 | 0 | 600 | 4.63 | 5/1/2017 | 4/30/2018 | - | |
COMM | 7 to 50 | 600 | 5000 | 5.14 | 5/1/2017 | 4/30/2018 | 27.78 | |
COMM | 51 to 951 | 5000 | 99500 | 4.40 | 5/1/2017 | 4/30/2018 | 226.16 | |
COMM | > 1000 | 99500 | 999999 | 3.05 | 5/1/2017 | 4/30/2018 | 4,158.00 |
Here is the calculated field:
Charge =
CALCULATE (
CALCULATE (
( SUM ( Summary[Qty-100CCF] ) - MAX ( RatesTable[USAGE FROM] ) )
* MAX ( RatesTable[RATE] )
+ MAX ( RatesTable[$Amount] ),
FILTER (
RatesTable,
SUM ( Summary[Qty-100CCF] ) < RatesTable[USAGE TO]
&& SUM ( Summary[Qty-100CCF] ) >= RatesTable[USAGE FROM]
),
FILTER (
RatesTable,
max(Summary[RunDate]) < RatesTable[DATE TO]
&& max(Summary[RunDate]) >= RatesTable[DATE FROM]
)
),
FILTER (
ALL ( 'Calendar' ),
Calendar[MonthID] = MAX ( Calendar[MonthID] )
&& Calendar[Date] <= MAX ( Calendar[Date] )
)
)
Any suggestiion are welcome.
Hi @vsteinly,
Could you please share us your pbix file with One Drive or Google Drive if possible? So that I can dig deeper and make some proper tests.
Also, please share us your expected result. It will help us get the right direction.
Thanks,
Xi Jin.
Have you looked at my model?
So I realized I didn't put enough information in my request. We are a Water utility and have a tiered rate structure is based on consumption of water. Each fiscal year our rates change. Below is what the end result would be looking at two different fiscal years and the rates being charges.
May 1, 2016 to April 30, 2017 | |||
5,500 | CCF | ||
Tier 1 | First 600 cubic feet at $4.60 per 100 cubic feet | 27.60 | |
Tier 2 | Next 4,400 cubic feet at $5.09 per 100 cubic feet | 223.96 | |
Tier 3 | Next 995,000 cubic feet at $4.29 per 100 cubic feet | 21.45 | |
Tier 4 | Over 1,000,000 cubic feet at $3.03 per 100 cubic feet | ||
273.01 | Total charged | ||
May 1, 2017 to April 30, 2018 | |||
5,500 | CCF | ||
Tier 1 | First 600 cubic feet at $4.63 per 100 cubic feet | 27.78 | |
Tier 2 | Next 4,400 cubic feet at $5.14 per 100 cubic feet | 226.16 | |
Tier 3 | Next 995,000 cubic feet at $4.40 per 100 cubic feet | 22.00 | |
Tier 4 | Over 1,000,000 cubic feet at $3.05 per 100 cubic feet | ||
275.94 | Total charged | ||
The result I'm seeing is all consumption coming back using the May 1, 2017 to April 30, 2018 Tier 1 rate (4.63).
https://drive.google.com/open?id=1XyNwimc0TjFjVw_jmzKO_SgXHF7MluwC
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |