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
RogerSteinberg
Post Patron
Post Patron

Divide each row by an aggregate of a category

Hi,

 

I am trying to calculate the monthly retention.

I have a table that looks like this :

b1, b2 are breakdowns (e.g. country, region)

join_date: (the month a users joined)

returned_date: the month the user returned 

 

join_dateidb1b2returned_date
Jan-19123xxxyyyFeb-19
Jan-19456xxxyyyMar-19
Feb-19666xxxyyyMar-19
Feb-19666xxxyyyApr-19
Feb-19777xxxyyyJun-19
Feb-19888aaabbbApr-19

 

I am trying to get to this:

join_datetotal count joined for the monthreturned_datecount of returnedrate
Jan-192Feb-19150%
Jan-192Mar-19150%
Feb-193Mar-19150%
Feb-193Apr-19266%
Feb-193Jun-19133%

 

How do I get my DAX formula to divide the current row to the total of the month . 

 

Thank you .

1 ACCEPTED SOLUTION
Anonymous
Not applicable

You can add b1 and b2 as conditions within the ALLEXCEPT function along with month, separated by commas.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Is month the only group that needs to be considered in this calc? Like b1 and b2 aren't relevant groupings for the monthly totals? Do you have a calendar dimension with months in it?

 

If so:

Total Count Joined for the Month = 
DIVIDE (
COUNT ( table[id]),
CALCULATE (
  COUNT ( table[id] ),
  ALLEXCEPT( calendar[month]),
0
)

The ALLEXCEPT will ignore all other contexts and just give a sum of all items by month.

b1 and b2 are relevant. Basically the breakdowns will be my slicers and the total join count will be affected by them. it should be aggreagated at the month level. i do have a calendar table.

Anonymous
Not applicable

You can add b1 and b2 as conditions within the ALLEXCEPT function along with month, separated by commas.

So thats the formula I wrote:

 

 

Distinct Count Join = CALCULATE(
    DISTINCTCOUNT(Query1[joined_email]),
    ALLSELECTED(
        Query1[joinDate],
        Query1[b1],
        Query1[b2],
        Query1[b3]
    )
)
Returned Count = 
CALCULATE(
    DISTINCTCOUNT(Query1[joined_email])
    )

 

 

But i get this :

 

joinDateDistinct Count JoinedRecurringDateBlankReturnedCountPercent
5/1/2019 0:00161955/1/2019 0:00161951
5/1/2019 0:00358556/1/2019 0:00358551
5/1/2019 0:00300327/1/2019 0:00300321
5/1/2019 0:00264318/1/2019 0:00264311
5/1/2019 0:00226849/1/2019 0:00226841
5/1/2019 0:002020310/1/2019 0:00202031
5/1/2019 0:001848911/1/2019 0:00184891
5/1/2019 0:001723012/1/2019 0:00172301
5/1/2019 0:00159841/1/2020 0:00159841

This distinct count joined column should remain static. the amount in the first row might confuse you but all i need is in the percent column to show 100% for that row. the Returned count column is correct all throughout.

Hi , @RogerSteinberg 

 

Select the measure or calculated column you created and try this button "%" .

 

60.png

Best Regards,
Community Support Team _ Eason

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.