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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register 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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors