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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Yarters
Frequent Visitor

Perfect Days Flag

Hi 

 

I'm new to DAX and have followed a number of guides which have got me started but I'm struggling to get something to work and would appreciate some help please!

 

I have an 'Event' table and a 'Calendar' table and want to produce a graph that shows by month the days when a specific event happened vs days when it didn't. If the event didn't happen, we call it a 'Perfect Day'. 

 

I have created the following measures :

 

No. of Events = CALCULATE COUNTROWS (Event) , Event [Did specific event occur?] = "Yes" )
 
Perfect Day =IF ( [No. of Events] > 0 , "No" , "Yes" )
 
This works in a table/graph with Calendar[Date] in, but unfortunately when I want to display this summarised by month, it is based on the event happening accross the month, and I want to keep the context at days and display something like this with one colour for 'Perfect' and one for 'Not Perfect':
 
Yarters_0-1675956710736.png

 

 

I think I am missing something, possibly very obvious but can't seem to work it out!

 

Thanks in advance

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

Num perfect days =
VAR SummaryTable =
    ADDCOLUMNS ( VALUES ( 'Calendar'[Date] ), "@num days", [No. of events] )
VAR Result =
    COUNTROWS ( FILTER ( SummaryTable, [@num days] = 0 ) )
RETURN
    Result

View solution in original post

2 REPLIES 2
Yarters
Frequent Visitor

Thanks, that gives me a count - and if I create another measure like this I can stack the 2 measures in a stacked bar - thanks for your help!

Num Imperfect Days =
COUNTROWS('Calendar') - [Num perfect days]
johnt75
Super User
Super User

Try

Num perfect days =
VAR SummaryTable =
    ADDCOLUMNS ( VALUES ( 'Calendar'[Date] ), "@num days", [No. of events] )
VAR Result =
    COUNTROWS ( FILTER ( SummaryTable, [@num days] = 0 ) )
RETURN
    Result

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.