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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
marcss44
Helper I
Helper I

Getting some measures from Count Distinct

Hi friends!

I've got a Matrix and i need to get the result of divide one columm by another (Both are distinct count fields). For example:

 

marcss44_0-1721623227983.png

I need to get the result of 24116/1290 at %.

And, finally I need to take this too:

marcss44_1-1721623286100.png

343456 divide by 1290.

How can I do it?

I've tried to Add a column but i can't put the column name.

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @marcss44 ,

 

you have to create two base measures like so:

M1 = DISTINCTCOUNT(<'table'[column1]>)

 and this

M2 = DISTINCTCOUNT(<'table'[column2]>)

 Based on this you can can create a third measure that divides the measures M1 and M2 rowwise like so:

M3 = DIVIDE( [M1], [M2] )

 And the 4th measure divides the M2 value by the Total value of M1:

M4 = DIVIDE( [M2] , CALCULATE( [M1] , ALL( <'thetableusedonrows'[rowheader] ) ) )

Then you can use all 4 measures in the value well of the Matrix visual.

 

Hopefully, this helps to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

4 REPLIES 4
TomMartens
Super User
Super User

Hey @marcss44 ,

 

you have to create two base measures like so:

M1 = DISTINCTCOUNT(<'table'[column1]>)

 and this

M2 = DISTINCTCOUNT(<'table'[column2]>)

 Based on this you can can create a third measure that divides the measures M1 and M2 rowwise like so:

M3 = DIVIDE( [M1], [M2] )

 And the 4th measure divides the M2 value by the Total value of M1:

M4 = DIVIDE( [M2] , CALCULATE( [M1] , ALL( <'thetableusedonrows'[rowheader] ) ) )

Then you can use all 4 measures in the value well of the Matrix visual.

 

Hopefully, this helps to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Hi again friend! How can I use row headers and obtain the division correctly?

Now I've added new row header and the calculate filed is not working:

marcss44_0-1721722956727.png

In green the new row header

Thank you very much!

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.