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

Calculating monthly worth of subscriptions

Hello everyone,

 

I'm trying to calculate the monthly (and/or quarterly) worth of subscriptions. Ideally, I'd be able to slice and dice by date at will. My data model consists of a date table with explicit monthnames and quarters like this:

DateYearQuarterMonthMonthnameYearmonthSchoolyear

30-01-2023

202311January20230122/23

 

My subscribers table has a lot of columns but the relevant ones are:

Subscriberstartdateenddatetotallessondaystotalamountdailyamount
John01-09-202230-09-20222929010
Bill01-10-202231-10-2022301505
Henry15-11-202215-01-2023602404

 

There is currently no relationship between them.

 

There are lots of examples on how to calculate a "snapshot table", basically generate a list for each subscriber with every active date, but this is very ineffecient and quickly expands the number of rows to huge numbers. Ideally, I want a dax measure that calculates for every selectable period what the current worth is, so that I can select by day, month, quarter or year.

 

I got going with this clever post by Reza Rad. I modified the formula because I don't need a check for blank enddates and I wanted the sumx of dailyamount, not a countrows (for active subscriptions). So my formula ended up fairly simple:

 
Dailytotal =
var _currDate=SELECTEDVALUE('Date'[Date])
return

SUMX(
            FILTER(
                       'Subscribers',
                      ('Subscribers'[enddate]>=_currDate )
                      && 'Subscribers'[startdate]<=_currDate
                      ),
             'Subscribers'[dailyamount]
)
 
It seems to work great, except it won't summarize by month, quarter, year or really anything other than day. Even when I throw Date and Dailytotal in a table, it won't sum but only display it per day. I must be missing something obvious; how do I sum these values?
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You can reuse your daily total measure like

Total for selected dates = SUMX( VALUES( 'Date'[Date]), [Daily total])

View solution in original post

2 REPLIES 2
johnt75
Super User
Super User

You can reuse your daily total measure like

Total for selected dates = SUMX( VALUES( 'Date'[Date]), [Daily total])

Gah, I knew it had to be something simple, thank you so much! I'm sure I tried a variation on that, but I couldn't quite get what I wanted.

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.

Top Solution Authors