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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
roshenrrujj
Frequent Visitor

How would you summarise this table

hey guys, i have this data table that i need to summarise in Power BI DAX

Data:

JobContractorContractor PaymentStateRegionTownWork StartedWork Ended
84397501086$10,329.26QLDQLD RuralRockhampton14/03/2023 
84412391126$82,135.70QLDQLD RuralRockhampton1/03/2023 
99095071148$4,020.85NSWNSW RuralTweed Heads3/05/2023 
84387201198$4,042.37QLDQLD RuralRockhampton3/02/202330/03/2023
84387201198$10,501.92QLDQLD RuralRockhampton3/02/202330/03/2023
84397501198$24,447.44QLDQLD RuralRockhampton12/04/2023 
84502451198$199,771.46NSWNSW RuralTweed Heads6/04/2023 
84504321305$43,029.86TASTASHobart24/05/2023 
84445721484$253,608.70QLDQLD RuralRockhampton16/02/2023 
99060181649$8,329.19VICVIC MetroMelbourne8/03/202323/05/2023
84542131655$75,492.70VICVIC RuralAlbury/Wodonga1/05/2023 
601013491743$913.68VICVIC MetroMelbourne12/01/202312/01/2023
84521161824$15,431.13SASAAdelaide12/05/2023 
84522631824$23,402.84WAWAPerth5/05/2023 
84429471832$169,773.98VICVIC MetroMelbourne25/01/2023 
84537001832$118,862.25VICVIC RuralBendigo27/02/2023 
84454121869$79,651.77QLDQLD RuralRockhampton6/04/2023 
99086981918$2,904.14QLDQLD MetroBrisbane28/02/2023 
99086981918$1,920.60QLDQLD MetroBrisbane28/02/2023 

 

 

 

how would you summarise that data in this way in DAX

ContractorStateAvg Contractor Payment in StateThe State overall averageDifference
1086QLD $                                             10,329.26 $                              52,171.3280%
1126QLD $                                             82,135.70 $                              52,171.32-57%
1148NSW $                                               4,020.85 $                            101,896.1696%
1198QLD $                                             12,997.24 $                              52,171.3275%
1198NSW $                                           199,771.46 $                            101,896.16-96%
1305TAS $                                             43,029.86 $                              43,029.860%
1484QLD $                                           253,608.70 $                              52,171.32-386%
1649VIC $                                               8,329.19 $                              74,674.3689%
1655VIC $                                             75,492.70 $                              74,674.36-1%
1743VIC $                                                   913.68 $                              74,674.3699%
1824SA $                                             15,431.13 $                              15,431.130%
1824WA $                                             23,402.84 $                              23,402.840%
1832VIC $                                           144,318.12 $                              74,674.36-93%
1869QLD $                                             79,651.77 $                              52,171.32-53%
1918QLD $                                               2,412.37 $                              52,171.3295%
2 ACCEPTED SOLUTIONS
tamerj1
Super User
Super User

Hi @roshenrrujj 
Please refer to attached sample file for the proposed solution

1.png

Table 2 = 
GENERATE ( 
    SUMMARIZE ( 
        'Table',
        'Table'[Contractor],
        'Table'[State]
    ),
    VAR AvgContractor = CALCULATE ( AVERAGE ( 'Table'[Contractor Payment] ) )
    VAR AvgState = CALCULATE ( AVERAGE ( 'Table'[Contractor Payment] ), ALLEXCEPT ( 'Table', 'Table'[State] ) )
    VAR PctDiff = DIVIDE ( AvgState - AvgContractor, AvgState )
    RETURN
        ROW ( "Avg Contractor Payment in State", AvgContractor, "The State overall average", AvgState, "Difference", PctDiff )
)

 

 

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @roshenrrujj 
Please refer to attached sample file for the proposed solution

1.png

Table 2 = 
GENERATE ( 
    SUMMARIZE ( 
        'Table',
        'Table'[Contractor],
        'Table'[State]
    ),
    VAR AvgContractor = CALCULATE ( AVERAGE ( 'Table'[Contractor Payment] ) )
    VAR AvgState = CALCULATE ( AVERAGE ( 'Table'[Contractor Payment] ), ALLEXCEPT ( 'Table', 'Table'[State] ) )
    VAR PctDiff = DIVIDE ( AvgState - AvgContractor, AvgState )
    RETURN
        ROW ( "Avg Contractor Payment in State", AvgContractor, "The State overall average", AvgState, "Difference", PctDiff )
)

 

 

thank you for that! Can i please ask:

- lets say i just need to use the state and contractor straight from the dataset (Rather than a DAX created table), and then have The State overall average, Avg Contractor Payment in State and difference as separate measures - would this be possible to implement? i tried your queries separate in measures and pulled them into a table visualisation, unfortunatley it did not work 😞

thanks so much! 🙏

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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