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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
gemcityzach
Helper IV
Helper IV

How would you collapse all of these measures to create a more succinct aggregation?

Hello fine folks,

I love PowerBI and I'm learning a ton as I go and reading a  ton of books. But with any new tool/language (M, DAX), there's so much I don't know how to do effeciently. Can you help me find a more succinct way to write these measures?

 

I have four tables of data that are related to an end-to-end business process. The data is in four different SharePoint lists. A user will complete records in List 1, then List 2, etc. The data is only related in the sense that it's part of the same business process. There is no other commonality among it that is germaine to this question.

 

Because the data is in four different tables, I have been struggling to come up with a way to aggregate completed records, total records, by Group and overall percentage complete. So, what I did was create a TON of measures in a new table that broke each step of each table/process down.

 

I.e., List 1, total records, total complete records, total records by group(1-4), total complete records by group(1-4), and did that across all four Lists. So as you can imagine I have like 50 measures to compute all of this.

 

Is there a better and more succinct way to write less measures to perform the same function? Below is an example of the code for one Group that cuts across all four tables. I've also attached a visual so you can see how the data is being populated.

 

--Table1 (EXT) Example (shows ID, Group(1-4 possible), Status1, Status2, recordStatus, which is 0 unless both Status1 and Status2 are complete, and tblName, which is unique to each of the four tables (EXT, REP, CUST, OSR).

 

IDGroup_NameStatus1Status2recordsStatustblName
1Group 1 Complete0EXT
2Group 1CompleteComplete1EXT
3Group 1Complete 0EXT
4Group 1CompleteComplete1EXT
5Group 2Complete 0EXT
6Group 2  0EXT
7Group 2CompleteComplete1EXT

 

Example of Total Table Calculations and Calculations from One of Four Groups

--Example of Total Table Calculations that pull data from all of the adjacent table measures
-----------------------------------------------------------------------------------------------

--Cust Completed Records
CALCULATE(COUNTROWS('event-customer_risk_acks'),'event-customer_risk_acks'[recordStatus]=1)+0

--Cust Total Records
COUNTROWS ( 'event-customer_risk_acks' )

--OSR Completed Records
CALCULATE(COUNTROWS('event-osr_acks'),'event-osr_acks'[recordStatus]=1)+0

--OSR Total Records
COUNTROWS('event-osr_acks')

--EXT Completed Records
CALCULATE(COUNTROWS('event-ext_risk_acks'),'event-ext_risk_acks'[recordStatus]=1)+0

--EXT Total Records
COUNTROWS('event-ext_risk_acks')

--Completed Records
[repTotalCompleteRecords]+[osrTotalCompleteRecords]+[extTotalCompleteRecords]+[custTotalCompleteRecords]

--Total Records
[repTotalCols]+[osrTotalCols]+[extTotalCols]+[custTotalCols]

--Overall Percentage Complete
DIVIDE([totalCompleteRecords],[totalRecords],0)


--Example of Analysis for One Group
--REP Completed Records
CALCULATE(
    COUNTROWS('event-rep_acks')
    ,'event-rep_acks'[Target Group] = "Group 1"
    ,'event-rep_acks'[recordStatus]=1
    ) +0

--REP Total Records
CALCULATE(COUNTROWS('event-rep_acks'),'event-rep_acks'[Target Group]="Group 1")+0

--REP Percentage Complete
DIVIDE([cm-repCompleteRecords],[cm-repTotalRecords],0)


-- OSR Completed Records
CALCULATE(
    COUNTROWS('event-osr_acks')
    ,'event-osr_acks'[Target Group] = "Group 1"
    ,'event-osr_acks'[recordStatus]=1
    ) +0

--EXT Completed Records
CALCULATE(
    COUNTROWS('event-ext_risk_acks')
    ,'event-ext_risk_acks'[Target Group]="Group 1"
    ,'event-ext_risk_acks'[recordStatus] = 1
)+0

-- OSR Total Records
CALCULATE(COUNTROWS('event-osr_acks'),'event-osr_acks'[Target Group]="Group 1")+0

--OSR Percentage Complete
DIVIDE([cm-osrCompleteRecords],[cm-osrTotalRecords],0)

--EXT Percentage Complete
DIVIDE([cm-extCompleteRecords],[cm-extTotalRecords],0)

-- EXT Total Recods
CALCULATE(
    COUNTROWS('event-ext_risk_acks')
    ,'event-ext_risk_acks'[Target Group]="Group 1"
)+0

--CUST Total Records
CALCULATE(
    COUNTROWS('event-customer_risk_acks')
    ,'event-customer_risk_acks'[Target Group]="Group 1"
)+0

DIVIDE([cm-osrCompleteRecords],[cm-osrTotalRecords],0)

--CUST Completed Records
CALCULATE(
    COUNTROWS('event-customer_risk_acks')
    ,'event-customer_risk_acks'[Target Group]="Group 1"
    ,'event-customer_risk_acks'[recordStatus] = 1
)+0

--CUST Total Records
CALCULATE(
    COUNTROWS('event-customer_risk_acks')
    ,'event-customer_risk_acks'[Operating Group]="Group 1"
)+0

--Cust Percentage Complete
DIVIDE([cm-custCompleteRecords],[cm-custCompleteRecords],0)

--Group 1 Overall Percentage Complete
([cm-custCompleteRecords]+[cm-osrCompleteRecords]+[cm-repCompleteRecords]+[cm-extCompleteRecords])/([cm-custTotalRecords]+[cm-osrTotalRecords]+[cm-repTotalRecords]+[cm-extTotalRecords])

 

example_screen.png

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@gemcityzach Can you UNION your tables together? Table.Combine in Power Query or UNION in DAX.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hey there. I suppose that is possible. But won't having all of those null values mess up filtering and counting of rows?

 

I figured that since I already had a table that's holding the individual measures, that there would be a more elegant way to bring many of the individual measures BY GROUP together? I.e., is there a way to combine all of the measures for a single group together instead of having 10+ measures?

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.