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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
JasonWelch
Frequent Visitor

Simple cumulative sum issue with live data

I have a live streaming dataset in the service and a report in desktop that direct queries that dataset.

 

The dataset has an order_datetime and order_qty field and some other dimensions (in one big table).

 

I create a measure:

cumulative = calculate(sum(order_qty),filter(all(mytable),order_datetime<=max(order_datetime)))

I create a table visual showing order_datetime and order_qty and my measure.

All is good ... every row where there is an order_qty I see the cumulative increase by that number.  Here is datetime, cmulative and qty:

JasonWelch_0-1694009686470.png

I change the measure:

cumulative = calculate(sum(order_qty),filter(allselected(mytable),order_datetime<=max(order_datetime)))

because I want other slicers on the report, slicing other dimensions of the order, to affect this cumulative total.  I apply a filter on the visual for order_datetime on or after midnight today and now here is datetime, cmulative and qty:

JasonWelch_1-1694010740444.png

All is bad!  Only some rows in the table of orders cause the cumulative to increase.  All the slicers are set to select all and no other visual or page filters other than the date; and I can't see any commonality between the rows that do cause the cumulative to increase.

 

I'm probably doing something completely obvious to you guys but I can't figure it at all! 😞

 

1 REPLY 1
JasonWelch
Frequent Visitor

So, in case anyone gets here in the future ... I suspected this was a data type issue and this is what I did ...

 

I exported my data to Excel and made a new report off the Excel file in which, of course, the measures work as expected.

 

On loading the Excel file, BI transforms my datetime column to datetime in M, like this:

JasonWelch_0-1694162846606.png

and it looks like a datetime in the canvas

JasonWelch_1-1694162910349.png

and it builds a date hierarchy off it in the Data pane.

 

In the live version, it claims to believe it's a (greyed-out) datetime but doesn't create the hierarchy (or prompt you with dot-notation when creating measures off it) ...

JasonWelch_2-1694163080327.png

 

CONCLUSION:  in the live version the measures don't work because it's not quite treating that field as a datetime somehow, even though it says it is

 

EDIT: the incoming data is a datetime from stream analytics - as it's end-to-end MS stuff I'm going to ask them!

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors