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
spandy34
Responsive Resident
Responsive Resident

DAX Grouping Totals

I wondered if someone could help me please.

 

I have a dataset which captures the actual quantity of care hours [ActualQuantity] against the planned amount of hours [PlannedActualQuantity] .

 

Below I have a measure that counts the number of records where the ActualQuantity is 25% more that the PlannedActualQuantity.

z_25% More =

COUNTROWS (

FILTER ( 'Spot Contracts', 'Spot Contracts'[ActualQuantity] > 'Spot Contracts'[PlannedActualQuantity] * 1.25 )

 

Each record has an associated Period Number [PeriodNo] which includes 28 days.  Each period includes 28 days. Instead counting the total ActualQuantity against PlannedActualQuantity for each visit (or record) that are 25% more, I have been asked to count the total ActualQuantity against PlannedActualQuantity for each Period that are 25% more, so how many periods have a total of 25% more ActualQuantity than PlannedActualQuantity.

 

Can anyone please help me amend this measure?

@EylesIT @amitchandak @tamerj1 @danextian @goncalogeraldes @Greg_Deckler 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @spandy34 ,

 

Based  on the information provided, try this measure:

 

Count = 
VAR __SUMMARY =
    ADDCOLUMNS (
        ADDCOLUMNS (
            SUMMARIZE ( 'Table', 'Table'[Period] ),
            "@Actual", CALCULATE ( SUM ( 'Table'[Actual] ) ),
            "@Planned", CALCULATE ( SUM ( 'Table'[Planned] ) )
        ),
        "@Rate", DIVIDE ( [@Planned], [@Actual] )
    )
RETURN
    COUNTROWS ( FILTER ( __SUMMARY, [@Rate] >= 1.25 ) )

danextian_0-1699942736706.png

 

Just change the table and column names accordingly.

If this isn't the case, please provide a sample data and your expected result (please do this for your future posts, not everyone has the time to create a sample data).





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

2 REPLIES 2
danextian
Super User
Super User

Hi @spandy34 ,

 

Based  on the information provided, try this measure:

 

Count = 
VAR __SUMMARY =
    ADDCOLUMNS (
        ADDCOLUMNS (
            SUMMARIZE ( 'Table', 'Table'[Period] ),
            "@Actual", CALCULATE ( SUM ( 'Table'[Actual] ) ),
            "@Planned", CALCULATE ( SUM ( 'Table'[Planned] ) )
        ),
        "@Rate", DIVIDE ( [@Planned], [@Actual] )
    )
RETURN
    COUNTROWS ( FILTER ( __SUMMARY, [@Rate] >= 1.25 ) )

danextian_0-1699942736706.png

 

Just change the table and column names accordingly.

If this isn't the case, please provide a sample data and your expected result (please do this for your future posts, not everyone has the time to create a sample data).





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thats great - thank you so much for your help.  Its worked .

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.