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
jofoster
Employee
Employee

Sum of distinct count across multiple days

Here is an example of my dataset:

 

DaystoMagicMoment     AccountID

    1                                      Account1

    1                                      Account2

   2                                       Account 3

   2                                       Account 4

 

I want to create a chart that woud show that 2 acccounts match DaytomagicMoment=1 and 4 Accounts when DaytomagicMoment=2. 

 

I have tried each of these, with no luck.

1) Rolling Totals  on the DistinctCount of AccountID

2) Measure = CALCULATE(DISTINCTCOUNT(Contributions[AccountID]),FILTER(Contributions,Contributions[DaystoMagicMoment]<=Contributions[DaystoMagicMoment]))

3)Measure 2 = SUMX(VALUES(Contributions[DaystoMagicMoment]),CALCULATE(DISTINCTCOUNT(Contributions[AccountID])))

 

Feels like this should be really easy, but no luck so far. Thanks for any help you can provide

3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

Hi @jofoster

 

Try following

 

Measure =
VAR myDay =
    SELECTEDVALUE ( Contributions[DaystoMagicMoment] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Contributions[AccountID] ),
        Contributions[DaystoMagicMoment] <= myDay
    )

Regards
Zubair

Please try my custom visuals

Thanks for the reply, but still not working for me

 

I converted your measure to 

TotalAccountsv2 = VAR MyDay = SELECTEDVALUE(Contributions[DaystoMagicMoment]) RETURN CALCULATE(DISTINCTCOUNT(Contributions[AccountID]),Contributions[DaystoMagicMoment]<=MyDay.

 

This yields the output below, which is not only obviousily incorrect ( i.e.,  each succeeding day should be greater than the day before), but also the Day 1 count is to high when compared to the actual data.

 

Appreciate your guidance.  thanks

 

PowerBIOutput.PNG

 

 

 

 

@jofoster,

 

It seems to work. Show us more information if possible.

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

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.