Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
example data:
| Location | EnergyConsumed | StartTime | Meter |
| road | 2 | 5/29/2018 13:00 | 0 |
| dock | 12 | 5/29/2018 13:00 | 0 |
| bridge | 2 | 5/29/2018 13:00 | 0 |
| Master Meter | 15 | 5/29/2018 13:00 | 1 |
| road | 3 | 5/29/2018 14:00 | 0 |
| dock | 4 | 5/29/2018 14:00 | 0 |
| bridge | 6 | 5/29/2018 14:00 | 0 |
| Master Meter | 14 | 5/29/2018 14:00 | 1 |
| road | 1 | 5/29/2018 15:00 | 0 |
| dock | 3 | 5/29/2018 15:00 | 0 |
| bridge | 5 | 5/29/2018 15:00 | 0 |
| Master Meter | 10 | 5/29/2018 15:00 | 1 |
I would like to sum EnergyConsumed like so,
SUMMARIZECOLUMNS(
HourlyEnergyData[StartTime],
"Total", SUM(HourlyEnergyData[EnergyConsumed]
)
that creates a new table with it that looks like this,
| Total | Date |
| 14 | 5/29/2018 13:00 |
| 13 | 5/29/2018 14:00 |
| 9 | 5/29/2018 15:00 |
but exclude "Master Meter" from the summarized sum, total.
Solved! Go to Solution.
Please try the following calculated table. I have attached a PBIX file with the code inside 🙂
Table =
VAR BaseTable = SUMMARIZECOLUMNS(
HourlyEnergyData[StartTime],
FILTER('HourlyEnergyData','HourlyEnergyData'[Meter]=0) ,
"Total", SUM(HourlyEnergyData[EnergyConsumed])
)
RETURN
ADDCOLUMNS(
BaseTable,
"Meter",MINX(
FILTER(
'HourlyEnergyData',
'HourlyEnergyData'[Meter]=1 &&
'HourlyEnergyData'[StartTime] = EARLIER('HourlyEnergyData'[StartTime])
),
'HourlyEnergyData'[EnergyConsumed])
)HI @Anonymous
The SUMMARIZECOLUMNS function accepts a filter parameter as an argument so perhaps try this
Table = SUMMARIZECOLUMNS(
HourlyEnergyData[StartTime],
FILTER('HourlyEnergyData','HourlyEnergyData'[Meter]=0) ,
"Total", SUM(HourlyEnergyData[EnergyConsumed])
)
Yes that worked to how it was specified.
However, can you modify it to also include a column "Meter Value"? the FILTER('HourlyEnergyData','HourlyEnergyData'[Meter]=0) , restricts me from adding "Meter Value" in as another column.
What do you want to put in the 'Meter' column?
The value of master meter,
ie. column of summed locations and column of master meter.
Thank you so much!
So based on the table you provided in the sample data. What would the expected value be?
| Total | Master Meter | Date |
| 14 | 15 | 5/29/2018 13:00 |
| 13 | 14 | 5/29/2018 14:00 |
| 9 | 10 | 5/29/2018 15:00 |
Please try the following calculated table. I have attached a PBIX file with the code inside 🙂
Table =
VAR BaseTable = SUMMARIZECOLUMNS(
HourlyEnergyData[StartTime],
FILTER('HourlyEnergyData','HourlyEnergyData'[Meter]=0) ,
"Total", SUM(HourlyEnergyData[EnergyConsumed])
)
RETURN
ADDCOLUMNS(
BaseTable,
"Meter",MINX(
FILTER(
'HourlyEnergyData',
'HourlyEnergyData'[Meter]=1 &&
'HourlyEnergyData'[StartTime] = EARLIER('HourlyEnergyData'[StartTime])
),
'HourlyEnergyData'[EnergyConsumed])
)The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 37 | |
| 33 | |
| 29 | |
| 27 |
| User | Count |
|---|---|
| 134 | |
| 104 | |
| 63 | |
| 60 | |
| 55 |