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
onedayover
Helper II
Helper II

Weekly year over year cumulative totals when weeks start on different dates

Hi all
I have a table for ticket purchases that looks like this...

Table.PNG

Ticket sales for 2023 start on a different date than in 2024. In order to do a comparison, I've added week numbers for each year starting at the first date tickets were sold (formatted as dd/mm/yyyy). I need to be able to plot cumulative totals on a graph like below but haven't been successul in making it work. Could someone please help me create a measure that will do this? Thanks

Graph.PNG

1 ACCEPTED SOLUTION
quantumudit
Continued Contributor
Continued Contributor

You can use the following DAX measure to get the desired result:

Cumulative Count = 
COUNTROWS (
    FILTER (
        ALL ( 'Table' ),
        'Table'[Week] <= MAX ( 'Table'[Week] )
            && 'Table'[Year] = MAX ( 'Table'[Year] )
    )
)


I have created the "Year" calculated column using the following DAX formula:

Year = YEAR('Table'[date])

Here is the solution screenshot in Power BI:

quantumudit_0-1712914016488.png

Best Regards,
Udit

If this post helps, please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍

🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
Visit My Linktree: LinkTree

 

 

 

View solution in original post

2 REPLIES 2
onedayover
Helper II
Helper II

Thanks quantumudit, that worked perfectly! I appreciate your help with this 🙂

quantumudit
Continued Contributor
Continued Contributor

You can use the following DAX measure to get the desired result:

Cumulative Count = 
COUNTROWS (
    FILTER (
        ALL ( 'Table' ),
        'Table'[Week] <= MAX ( 'Table'[Week] )
            && 'Table'[Year] = MAX ( 'Table'[Year] )
    )
)


I have created the "Year" calculated column using the following DAX formula:

Year = YEAR('Table'[date])

Here is the solution screenshot in Power BI:

quantumudit_0-1712914016488.png

Best Regards,
Udit

If this post helps, please consider Accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudo 👍

🚀 Let's Connect: LinkedIn || YouTube || Medium || GitHub
Visit My Linktree: LinkTree

 

 

 

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.