This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
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])
)Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 33 | |
| 25 | |
| 23 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 64 | |
| 41 | |
| 27 | |
| 22 | |
| 22 |