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.
The dataset looks something like this and is only downloaded for a given month:
data.energy | location.circuit | received |
24026 | total | 10/08/2019 00:59 |
23906 | total | 09/08/2019 21:50 |
22589 | total | 09/08/2019 04:45 |
10258 | socket | 10/08/2019 00:30 |
10134 | socket | 09/08/2019 13:56 |
9945 | socket | 07/08/2019 23:34 |
2458 | light | 09/08/2019 14:45 |
2223 | light | 05/08/2019 23:47 |
2046 | light | 02/08/2019 15:29 |
I am interested in the energy consumption per circuit for that month. As the energy values constantly increase, I would like to calculate the difference with the MIN for that month at each point in time (i.e. keep it incremental, but remove the offset). As the energy data mixes all the different circuits together, I need to figure out the MIN for each circuit and substract accordingly (presumably using filters).
I tried something like the below, but to no success:
EnergyUsed =
CALCULATE(
SUM(August[data.energy]),
FILTER(
ALLEXCEPT(August, August[location.circuit]),
August[data.energy] = MIN(August[data.energy])
)
)
So assuming the MIN for total was 22000, for socket the MIN was 9900 and for light the MIN was 2000, I would expect the results to look like this:
data.energy | location.circuit | received |
2026 | total | 10/08/2019 00:59 |
1906 | total | 09/08/2019 21:50 |
589 | total | 09/08/2019 04:45 |
358 | socket | 10/08/2019 00:30 |
234 | socket | 09/08/2019 13:56 |
45 | socket | 07/08/2019 23:34 |
458 | light | 09/08/2019 14:45 |
223 | light | 05/08/2019 23:47 |
46 | light | 02/08/2019 15:29 |
Solved! Go to Solution.
@Anonymous ,
Create a calculate column using dax below:
EnergyUsed = SWITCH(August[location.circuit], "total", August[data.energy] - 22000, "socket", August[data.energy] - 9900, "light", August[data.energy] - 2000)
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous ,
Create a calculate column using dax below:
EnergyUsed = SWITCH(August[location.circuit], "total", August[data.energy] - 22000, "socket", August[data.energy] - 9900, "light", August[data.energy] - 2000)
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks @v-yuta-msft for picking this up. (Original this post was refused, so I had to submit it again and got an answer, see here: https://community.powerbi.com/t5/Desktop/Difference-between-MIN-and-current-values-based-on-filter-o...)
However, your solution would work, too (so I'll mark it), but it would be quite labour intensive, i.e. every month when I download a new dataset, I would need to manually figure out the mininmum for each location.circuit....
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 |
---|---|
114 | |
101 | |
78 | |
75 | |
49 |
User | Count |
---|---|
145 | |
108 | |
107 | |
89 | |
61 |