Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
mustafaelryah33
Frequent Visitor

dax two dates one id

Dear all 

 I have 2 dates and id column in one table I want to have calendar to calculate how many different id's appeared within each date, I used countrows and working good but it calculate all rows not the distinct one. I want to cxount only distinct count of id's

 

 

this the calculated column I used

 

 

 

 

CouncilCount = 
var _CurrentRowValue = CountBook[Date]
RETURN
COUNTROWS(
    Filter(Sheet1,
    _CurrentRowValue=Sheet1[CancelDate]
))

 

 

 

 

 

 MicrosoftTeams-image (1).png

1 ACCEPTED SOLUTION
mustafaelryah33
Frequent Visitor

Thanks for your reply

IT works with another formula using early

 

CouncilCount = 

CALCULATE(DISTINCTCOUNT('Sheet1'[id]),

filter(Sheet1,

       Sheet1[pCancelDate]=earlier(CountBook[Date])

   )

)

View solution in original post

3 REPLIES 3
mustafaelryah33
Frequent Visitor

Thanks for your reply

IT works with another formula using early

 

CouncilCount = 

CALCULATE(DISTINCTCOUNT('Sheet1'[id]),

filter(Sheet1,

       Sheet1[pCancelDate]=earlier(CountBook[Date])

   )

)

Hi @mustafaelryah33 ,

 

I'm glad your problem was solved, please mark it as a solution so that more people can find it quickly.

 

Best Regards

Community Support Team _ chenwu zhu

 

v-chenwuz-msft
Community Support
Community Support

Hi  , 

Please use DISTINCTCOUNT(<column>) to count the distinct one. In your case, code like the following:Best Regards

 

CouncilCount =

VAR _CurrentRowValue = CountBook[Date]

RETURN CALCULATE( DISTINCTCOUNT( Sheet1[ID] ), FILTER( Sheet1, _CurrentRowValue = Sheet1[CancelDate] ) ) 

 

 

 If it does not work, please provide some example data and expect output

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.