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
TDisco
Helper I
Helper I

Cumulative Count in Line Graph

Having a issue I can't search a solution for. I've tried others, but I just can't make this work.

 

I have a single Table that contains each time a user logs in. I want to have a yearly cumalitve total on a graph. I can't get them to display over each other - just side-by-side. (when by month)

 

TDisco_0-1669052889226.png

I started with an ALL Cumulative measure--- this works great and restarts at the YEAR mark.

m_LoginsCountYTDAll =
CALCULATE (
    COUNT('tbl_Logins'[UserName] ),
    FILTER (
        ALL ( 'Date' ),
        'Date'[Date] <= MAX ( 'Date'[Date] )
            && 'Date'[Year] = MAX ( 'Date'[Year] )
    )
)
 

I have two measures that divide the counts into two years.

m_LoginsCount2021 = CALCULATE([m_LoginsCountAll], 'Date'[Year] = 2021)
m_LoginsCount2022 = CALCULATE([m_LoginsCountAll], 'Date'[Year] = 2022)
 

Then I have these to get me a cumulative total.

2021

m_LoginsCountYTD2021 =
IF([m_LoginsCount2021] <> 0,
CALCULATE (
    [m_LoginsCount2021],
    FILTER (
        ALLSELECTED ( 'Date' ),
        'Date'[Date] <= MAX ( 'Date'[Date] )
            && 'Date'[Year] = MAX ( 'Date'[Year] )
    )
), "")
 
2022
m_LoginsCountYTD2022 =
IF([m_LoginsCount2022] <> 0,
CALCULATE (
    [m_LoginsCount2021],
    FILTER (
        ALLSELECTED ( 'Date' ),
        'Date'[Date] <= MAX ( 'Date'[Date] )
            && 'Date'[Year] = MAX ( 'Date'[Year] )
    )
), "")
 
All of this works great in a table. When I graph it, it either gives me the above screen shot when by month, or it divides it by year, when I add the year (and month).
TDisco_1-1669053258906.png

 

 

How do I get them to share the same month on the graph (overlap the year)

I'm so close - just missing the mark. Thank you in advance.

1 ACCEPTED SOLUTION
TDisco
Helper I
Helper I
3 REPLIES 3
TDisco
Helper I
Helper I

Shaurya
Memorable Member
Memorable Member

Hi @TDisco,

 

Why don't you try creating a table just a list of month names and number, no year or date column. Join the month number from this new table to the month number in the date table and use month name as X-Axis in your visuals.

 

Works for you? Mark this post as a solution if it does!
Check out this blog of mine: How to Export Telemetry Data from Azure IoT Central into Power BI

No-go, but thank you

(not sorted - but still, same response)

TDisco_0-1669064224498.png

 

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.