cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cooksteve09
Frequent Visitor

Excel formula to Dax - Counting distinct values based on the date

Morning all,

 

I am hoping for a little help to convert the following formual to Dax or advice as this maybe easier utilising a calculated table?

 

Basically it is counting distinct values based on the date

 

=SUM(--(FREQUENCY(IF([@[Offer_Date]]=[Offer_Date], COUNTIF([Offer_Account], "<"&[Offer_Account]), ""), (COUNTIF([Offer_Account], "<"&[Offer_Account])))>0))

 

Any help would be greatly appreciated

 

Cheers

1 ACCEPTED SOLUTION
cooksteve09
Frequent Visitor

Found this in another topic and works great once adjusted for my table and column names

 

Measure 2 = var _table=SUMMARIZE('Table','Table'[Shop],'Table'[Date],"distinctcount",DISTINCTCOUNT('Table'[Customer]))
return
SUMX(_table,[distinctcount])

  

View solution in original post

5 REPLIES 5
cooksteve09
Frequent Visitor

Found this in another topic and works great once adjusted for my table and column names

 

Measure 2 = var _table=SUMMARIZE('Table','Table'[Shop],'Table'[Date],"distinctcount",DISTINCTCOUNT('Table'[Customer]))
return
SUMX(_table,[distinctcount])

  

Jos_Woolley
Solution Sage
Solution Sage

Post a small copiable dataset together with expected results.

Regards

Jos_Woolley
Solution Sage
Solution Sage

Perhaps this measure:

MyMeasure =
CALCULATE(
    DISTINCTCOUNT( 'Table'[Offer_Account] ),
    ALLEXCEPT( 'Table', 'Table'[Offer_Date] )
)

Regards

Thank you but that seems to be counting Distinct Accounts only....if the account appears on different days i need it to count both instances

 

hope that makes sense

But unless I'm mistaken your Excel formula is not doing that - the part

IF([@[Offer_Date]]=[Offer_Date],...

means that the counts will be for a given date only.

Regards

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors