Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
dpearson123
New Member

Daily totals from cumulative total

Hello all

 

I am trying to caculate the two empty colulmns in the below: MonoPagsSinceLastReading &  ColourPagsSinceLastReading. The data set is a running totals of usage readings from a fleet of printers and I need to caluclate the the daily readings by serial number.  What would the best way to do this? 

Would it be to create a measure do it for the whole fleet and then it can be filtered? Or create the colmn. It would need to be something like PagesSinceLastReading = current reading - previous reading if serial number is the serial number is the same. 

 

I am using the below at the moment but it doesn't take into account mutiple readings on the same day and the initial reading. So if a printer first comes online and already has 100,000 prints on it, it'll show 100,000 as it's daily usage. 

 

dailyMono2 =
VAR CurDay = Counters[ReadingDate]
VAR T1 = FILTER(Counters,'Counters'[SerialNumber]=EARLIER(Counters[SerialNumber]))
VAR PreDay = MAXX(FILTER(T1,Counters[ReadingDate]<CurDay),Counters[ReadingDate])
RETURN
Counters[Mono] - MAXX(FILTER(T1,Counters[ReadingDate]=PreDay),Counters[Mono])

 

dpearson123_0-1622025006462.png

Any help would be great please 

 

Thanks

 

David 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@dpearson123 , if you have multiple reading a day and you do not have date-time field then add an index field

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

and use that

 

dailyMono2 =
VAR CurDay = Counters[index]
VAR T1 = FILTER(Counters,'Counters'[SerialNumber]=EARLIER(Counters[SerialNumber]))
VAR PreDay = MAXX(FILTER(T1,Counters[index]<CurDay),Counters[index])
RETURN
Counters[Mono] - MAXX(FILTER(T1,Counters[index]=PreDay),Counters[Mono])

 

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@dpearson123 , if you have multiple reading a day and you do not have date-time field then add an index field

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

and use that

 

dailyMono2 =
VAR CurDay = Counters[index]
VAR T1 = FILTER(Counters,'Counters'[SerialNumber]=EARLIER(Counters[SerialNumber]))
VAR PreDay = MAXX(FILTER(T1,Counters[index]<CurDay),Counters[index])
RETURN
Counters[Mono] - MAXX(FILTER(T1,Counters[index]=PreDay),Counters[Mono])

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.