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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.