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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.


Go to My LinkedIn Page


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.


Go to My LinkedIn Page


That's it.

 

Thanks a lot"

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors