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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
soldous
Advocate II
Advocate II

Occurrence by day with Summarizecolumns

Hi there,

 

I have a measure to calculate the occurrence when a shift is longer than 6 hours:

 

Occurrence = COUNTX (
        FILTER (
            SUMMARIZECOLUMNS (
                Timekeeping_Data[Date],
                Timekeeping_Data[SHIFT_ID],
                Timekeeping_Data[FirstName],
                "shift", DATEDIFF([FistDayStart],[FistBreakStart],MINUTE)/60
            ),
            [shift] > 6
        ),
        Timekeeping_Data[FirstName]
    )

 

It works fine when I put the measure to the card visual and also when I filter the whole page by Timekeeping_Data[Date] but when I want to create the occurrence by date using the bar chart I'm receiving the error:

 

SummarizeColumns() and AddMissingItems() may not be used in this context.

 

Could someone help me with modifying the measure to be used in the bar chart per day?

 

Thanks a lot.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your dataset looks like, but please try something like below.

 

Occurrence =
COUNTX (
    FILTER (
        ADDCOLUMNS (
            SUMMARIZE (
                Timekeeping_Data,
                Timekeeping_Data[Date],
                Timekeeping_Data[SHIFT_ID],
                Timekeeping_Data[FirstName]
            ),
            "@shift", CALCULATE ( DATEDIFF ( [FistDayStart], [FistBreakStart], MINUTE ) ) / 60
        ),
        [@shift] > 6
    ),
    Timekeeping_Data[FirstName]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your dataset looks like, but please try something like below.

 

Occurrence =
COUNTX (
    FILTER (
        ADDCOLUMNS (
            SUMMARIZE (
                Timekeeping_Data,
                Timekeeping_Data[Date],
                Timekeeping_Data[SHIFT_ID],
                Timekeeping_Data[FirstName]
            ),
            "@shift", CALCULATE ( DATEDIFF ( [FistDayStart], [FistBreakStart], MINUTE ) ) / 60
        ),
        [@shift] > 6
    ),
    Timekeeping_Data[FirstName]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

That's it.

 

Thanks a lot"

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 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.