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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
S_N_L_A
Frequent Visitor

DAX Average based on text - AVG grouped by other column value

Hi!

 

I'm certain that there is an answer to this that I've stumbled upon before. But after almost 2 days of searching (probably my searching skills that are lacking) I'll have to post a question.

 

I have a table where two of the columns are Region and Status.

What I'd like to do is to create a DAX which calculates the average count of "Status" per "Region" as well as total.

In other words the end result (that I want to have as a visualization) should be:

 Not startedCompletedDelayed
Europe 66%33%
Asia100%  
Africa50% 50%
Latin America 100% 
Total25%62,5%12,5%

 

RegionStatus
EuropeCompleted

Europe

Delayed
AsiaNot Started
EuropeCompleted
AfricaNot Started
Latin AmericaCompleted
Latin AmericaCompleted
AfricaCompleted

 

Thanks in advance!

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@S_N_L_A , Try a measure like

 

divide(counrows(Table), calculate(counrows(Table), filter(allselected(Table), Table[Region] = max(Table[Region]))))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

VahidDM
Super User
Super User

Hi @S_N_L_A 

 

Try this:

 

Measure = 
COUNTROWS ( 'Table' )
    / CALCULATE ( COUNTROWS ( 'Table' ), REMOVEFILTERS ( 'Table'[Status] ) )

 

 

the output:

VahidDM_0-1635762425360.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

 

View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @S_N_L_A 

 

Try this:

 

Measure = 
COUNTROWS ( 'Table' )
    / CALCULATE ( COUNTROWS ( 'Table' ), REMOVEFILTERS ( 'Table'[Status] ) )

 

 

the output:

VahidDM_0-1635762425360.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

 

amitchandak
Super User
Super User

@S_N_L_A , Try a measure like

 

divide(counrows(Table), calculate(counrows(Table), filter(allselected(Table), Table[Region] = max(Table[Region]))))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.