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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
darkstar00187
New Member

DAX functionality

Hi,

 

Who can help me to find a solution for my problem.

 

I've a table with the following content:

Account NameProduct NamePRIO
TestTest_11
TestTest_22
TestTest_44
ListTest_22
SOFTWARETest_155
SOFTWARETest_164

 

In a another table or if possible directly in 2 graphs I would like to have following output:

  • Count the unique accounts based on the highest prio for each account
  • Count the amount of product refered to the highest prio

Solution -->

PRIO/12345
Accounts01011
Producten01032

 

 

Thanks a lot!

Stephanie

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

OK, here we go. My base data table is Table2. Create a disconnected table with a [Name] column with two rows, "Accounts" and "Products". This is Table3 in my example. Now create the following measure:

 

Measure = 
VAR __maxPrio = MAX([PRIO])
VAR __tableAccounts = SUMMARIZE(ALL('Table2'),[Account Name],"__prio",MAX([PRIO]),"__products",COUNT([Product Name]))
VAR __countAccounts = COUNTX(FILTER(__tableAccounts,[__prio]=__maxPrio),[Account Name])
VAR __countProducts = SUMX(FILTER(__tableAccounts,[__prio]=__maxPrio),[__products])
RETURN
SWITCH(
    TRUE(),
    MAX('Table3'[Name])="Accounts",__countAccounts,
    MAX('Table3'[Name])="Products",__countProducts
)

Now create a matrix visualization with 'Table3'[Name] as the Rows, 'Table2'[PRIO] as the Columns and [Measure] as the Values.

 

 



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...

View solution in original post

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

OK, here we go. My base data table is Table2. Create a disconnected table with a [Name] column with two rows, "Accounts" and "Products". This is Table3 in my example. Now create the following measure:

 

Measure = 
VAR __maxPrio = MAX([PRIO])
VAR __tableAccounts = SUMMARIZE(ALL('Table2'),[Account Name],"__prio",MAX([PRIO]),"__products",COUNT([Product Name]))
VAR __countAccounts = COUNTX(FILTER(__tableAccounts,[__prio]=__maxPrio),[Account Name])
VAR __countProducts = SUMX(FILTER(__tableAccounts,[__prio]=__maxPrio),[__products])
RETURN
SWITCH(
    TRUE(),
    MAX('Table3'[Name])="Accounts",__countAccounts,
    MAX('Table3'[Name])="Products",__countProducts
)

Now create a matrix visualization with 'Table3'[Name] as the Rows, 'Table2'[PRIO] as the Columns and [Measure] as the Values.

 

 



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...

Helpful resources

Announcements
60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.