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.
Meter 1 Consumption =
VAR ConsumptionToday =
CALCULATE(SUM(ConsumptionDaily[QC Meter 1]))
VAR ConsumptionPriorDay =
CALCULATE(SUM(ConsumptionDaily[QC Meter 1]), PREVIOUSDAY('ConsumptionDaily'[Date]))
VAR DIFF =
ConsumptionToday - ConsumptionPriorDay
RETURN
IF(ISBLANK(ConsumptionPriorDay),BLANK(),IF(DIFF<0,DIFF+9999999,DIFF))
You should use the effect of a telescopic sum here.
Instead of summing over all of the daily consumptions, just calculate the difference between first consumption and last consumption within the time, using your logic:
Meter 1 Consumption =
VAR MaxDate = MAXX(Datecolumn)
VAR MinDate = MINX(Datecolumn)
VAR ConsumptionEnd =
CALCULATE(SUM(ConsumptionDaily[QC Meter 1]), date = MaxDate)
VAR ConsumptionStart =
CALCULATE(SUM(ConsumptionDaily[QC Meter 1]), Datecolumn = MinDate)
VAR DIFF =
ConsumptionEnd - ConsumptionStart
RETURN
IF(ISBLANK(ConsumptionStart),BLANK(),IF(DIFF<0,DIFF+9999999,DIFF))
Might need to substract one day from MinDate.
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 |
---|---|
48 | |
24 | |
20 | |
14 | |
12 |
User | Count |
---|---|
55 | |
48 | |
43 | |
19 | |
18 |