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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Help with measure to count where an event occured on a date

Hi experts,

I'm looking for some assistance in creating a measure that checks if one event or more occured on a particular date if it did then count as 1 ifelse 0.

I can easily count the total number of events that occur on a particular day but I'm stumped on how I create a measure to count only 1 where there may be many.

Amny help would be great.

Phil

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

You can create another measure as below to get it, please find the details in the attachment.

Number of dates which have events = SUMX(VALUES('Date'[Date]),[Measure])

yingyinr_0-1669862649048.png

Best Regards

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

You can create a measure as below to get it, please find the details in the attachment.

Measure = 
VAR _seldate =
    SELECTEDVALUE ( 'Date'[Date] )
VAR _count =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Event] ),
        FILTER ( 'Table', 'Table'[Date] = _seldate )
    )
RETURN
    IF ( _count >= 1, 1, 0 )

yingyinr_0-1669800274953.png

Best Regards

Anonymous
Not applicable

Hi @Anonymous ,

Thank you for the reply, your calculation does exactly what I was hoping to do.
I do have one final question though, If I want to count the number days where there was an event how do I add that to the DAX?

What I need to be able to calculate is the number of dates where there was an event on, and the number dates where there wasn't an event on.

Kind regards

Phil

 

Anonymous
Not applicable

Hi @Anonymous ,

You can create another measure as below to get it, please find the details in the attachment.

Number of dates which have events = SUMX(VALUES('Date'[Date]),[Measure])

yingyinr_0-1669862649048.png

Best Regards

NikhilChenna
Skilled Sharer
Skilled Sharer

Hi @Anonymous ,

 

Consider this below example, 

Event    Date

A           11/29/2022

A           11/29/2022

B           11/29/2022

C           11/29/2022

So suppose if  condition is that on 29th Nov 22, A event should occur.

 

Then you have to create a calculated column in you table as ,

Calculated Column = IF('table1'[Date]="11/29/2022" && 'table1'[Event]="A",1,0)

 

So you'll get the output as below,

Event    Date                Eventsoccured

A           11/29/2022     1

A           11/29/2022     1

B           11/29/2022     0

C           11/29/2022     0

 

For getting the distinct count for this you have to use a calculated measure, 

Distinctcount =
CALCULATE(
DISTINCTCOUNT ('table1'[Eventsoccured]),
FILTER('table1','table1'[Eventsoccured]=1)
)

 

This will solve your issue.

 

Regards,

Nikhil Chenna

 

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.