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
acanepa
Resolver I
Resolver I

Divide as Pivot Table

Hello,

 

I'm having problems with the division in PowerBI. The report is for repurchase rate. I have a database with a list of clients, where I have month of purchase, money spent and more. The most important is a binary column where 1 is client made a buy last 90 days. (RR_2)

 

I create a calculated field (column) where I want to divide two values (the division I wa

nt to obtain by month of the year).

 

1) Sum by month of binary column. This Field is called RR_2. The calculation of value 

2) The total sum of rows in a column. This Field is called RR_by_Month

2.1) Counter with value 1 in all rows.

 

When I make the division between this two fields I can't have the exact number. For example If I have 3000 clients with a repurchase and a total of 20.000 clients that month that have buy, the repurchase rate going to be 15% but intead the division give me 1,5%.

 

I ave tryed the next calcultations

 

divide(RR_2,countrows8'table')

divide(RR_2, counter)

divide(sum(RR_2),SUM(COUNTER))

DIVIDE(RR_2, COUNTA(DATE_FIELD))

DIVIDE(RR_2,AVERAGE(RR_BY_MONTH)

 

If I how the values by numerator and denominator is gives the numbers that I want but I divide the 2 numbers give me strange numbers, I think is for the level of aggregation of the DAX formulas that I don't undestand.

 

 

Here is a litle example of a table

 

Monthnumber  | RR2 | Counter| RR_BY_MONTH

01-11-2015      | 1      |    1        | 3

01-11-2015      | 0      |    1        | 3

01-11-2015      | 0      |    1        | 3

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

You should not need any column other than RR_2 and your date column. Create a measure with the following formula:

 

Measure = DIVIDE(SUM([RR_2]),COUNT([RR_2]))

 

Note that:

 

Measure = SUM(RR_2)/COUNT(RR_2])

 

will also work if you are not worried about divide by zero issues, which you probably don't need to worry about since you shouldn't have zero rows.



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

You should not need any column other than RR_2 and your date column. Create a measure with the following formula:

 

Measure = DIVIDE(SUM([RR_2]),COUNT([RR_2]))

 

Note that:

 

Measure = SUM(RR_2)/COUNT(RR_2])

 

will also work if you are not worried about divide by zero issues, which you probably don't need to worry about since you shouldn't have zero rows.



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