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

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.

Reply
BCMRC
Regular Visitor

Issue with running cumulative totals when there is no data for a time period

Hi Power BI Community - I am in deperate need for some help.

 

I am tracking sales on a daily basis and have created a matrix table that consists of actual daily sales & cumulative sales based on the date.

 

To do this I have created a date table and created a relationship as below:

 

Capture2.PNGCapture3.PNG

 

The measure to create the cumulative total is:

 

CumulativeCount = 
IF (
    MIN ( LeadTable[ID] )
        <= CALCULATE ( MAX ( TICKETS[LeadTime] ), ALL ( TICKETS )),
                CALCULATE (
                    [TicketSales],
                    FILTER (
                        ALL(TICKETS),
                        [LeadTime] <= MIN (LeadTable[LeadTime])
                    )
                )
)

where [TicketSales] is a measure using COUNTROWS('TICKETS')

 

which works perfectly and enables me to produce the following table:

 

Capture.PNG

 

The issue I have is that the data only shows up until the last ticket sale. For example, in the table above, let's say todays date is Tuesday 19th June. You can see that data is only showing up until Saturday 16th of June because there were no ticket sales on Sunday 17th and Monday the 18th. 

 

I would like to show data up until todays date regardless if there has been ticket sales or not. In the case above, it would show either blank or 0's and the cumulative figure would also then kick in up until todays date.

 

Any help from you experts out there would be much appreciated!!!!

 

Thanks in advance

 

Cheers

 

 

 

6 REPLIES 6
v-yulgu-msft
Employee
Employee

Hi @BCMRC,

 

Please try this:

CumulativeCount = 
IF (
    MIN ( LeadTable[ID] )
        <= CALCULATE ( MAX ( TICKETS[LeadTime] ), ALL ( TICKETS )),
                CALCULATE (
                    [TicketSales],
                    FILTER (
                        ALL(TICKETS),
                        [LeadTime] <= MIN (LeadTable[LeadTime])
                    )
                )
)
+0

Regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yulgu-msft

 

I already tried that but it caused more issues with the crossjoins as it is a matrix table

 

see below screenshot on what happens when putting a "+0" at the end of the measure

 

Capture4.PNG

BCMRC
Regular Visitor

last call for any help from anybody out there? TIA

Hi,

 

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur

 

thank you for your response

 

Please see the link below to download the pbix file. I've had to obviously create dummy data as i am working with confidential information

 

Download Here

 

Hope you can help

 

cheers

BCMRC
Regular Visitor

anyone?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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