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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
andyt
Frequent Visitor

Pivot table equivalent %of base field

I'm trying to replicate a pivot table in Power Bi which uses a base field and reports a % from that

 

In excel it is done by using the Show Value as ->% of... and then choose a baase item.

 

What I'm trying to do is show a series as a % of the first month, ie retained %.

 

Is this possible?

 

Thanks

1 ACCEPTED SOLUTION

Hi @andyt

 

I think I have managed to solve your issue, as long as you keep on using the Month Numbers.

 

What I did was to change the shape of your data so that it made it easier to work with, which is something that is very common when designing datasets.

 

Then what I did was to create the following measures below.

 

// This is the default measure to get the amounts
Sales = SUM(Table1[Amount])

//This measure then only gets the Value where it is equal to Month 1
Month 1 Value = CALCULATE([Sales],Table1[Month] = 1)

//This measure then does the calculation for the % of Base Field.
% of Base Value = DIVIDE([Sales],[Month 1 Value])

To better explain what the measure [Month 1 Value] is doing, there is an image below, which you can then see because I hard coded the Sales for Month 1, it will repeat across all the data.

 

Email Pic (1).png

So once I got the above the final measure then dropped into place, and I got the same results as with your sample.

 

Email Pic (1).png

I have also got a link for the Power BI Desktop file.

https://1drv.ms/u/s!Apxn-69XhcAmhr5lR4KaCo8YNudFSQ





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

View solution in original post

7 REPLIES 7
GilbertQ
Super User
Super User

Hi @andyt

 

This is possible and in some instances it can be done when you are using a table, but if you want to do this in a visual then you have to create a DAX measure.

 

Below is a blog post explaining how I did this;

https://www.fourmoo.com/2017/07/18/power-bi-dax-measures-for-excel-based-of-column-total-or-of-row-t...

 

If this is not exactly what you are looking for let us know, with some sample data and I am sure we can get it working.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Thanks for this. It is as part of a matrix, so the % of row and % of column are available already.

 

What I'm trying to do is the equivalent of % of base field. So if the below is a pivot table, and the % column shows month 2-12 as a % of month 1.

 

Does that make sense?

 

Month%sum
1100.0%186
282.3%153
382.3%153
479.0%147
574.7%139
672.0%134
771.5%133
870.4%131
964.5%120
1068.3%127
1165.6%122
1260.8%113

Hi @andyt

 

Thanks for more details, I am not 100% sure of the required outcome (Could be a Monday morning thing!)

 

What should be the desired result off the dataset you provided?

That will help me understand how to get to that result.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Below is the pivot table with payments from customers, so 13566 paid in mnth 1, 9517 in month 2, 9585 in Month 3 etc

 

PaymentsFY 
Month2015/162016/17
1135663005
295172434
395852187
486782021
580291835
674961666
770321558
866401450
962951370
1059061276
1156191233
1253861143

 

In excel, to show this as a % of month 1, I use the show values as, %of, based field = Month, Base Item = 1.

 

this gives me

 

RetentionFY 
Month2015/162016/17
1100.00%100.00%
270.15%81.00%
370.65%72.78%
463.97%67.25%
559.18%61.06%
655.26%55.44%
751.84%51.85%
848.95%48.25%
946.40%45.59%
1043.54%42.46%
1141.42%41.03%
1239.70%38.04%

 

So for example, i can see of those customers who made a payment in month 1, 55.26% paid in month 6.

 

Does that help?

 

Thanks for your time

 

Hi @andyt

 

I think I have managed to solve your issue, as long as you keep on using the Month Numbers.

 

What I did was to change the shape of your data so that it made it easier to work with, which is something that is very common when designing datasets.

 

Then what I did was to create the following measures below.

 

// This is the default measure to get the amounts
Sales = SUM(Table1[Amount])

//This measure then only gets the Value where it is equal to Month 1
Month 1 Value = CALCULATE([Sales],Table1[Month] = 1)

//This measure then does the calculation for the % of Base Field.
% of Base Value = DIVIDE([Sales],[Month 1 Value])

To better explain what the measure [Month 1 Value] is doing, there is an image below, which you can then see because I hard coded the Sales for Month 1, it will repeat across all the data.

 

Email Pic (1).png

So once I got the above the final measure then dropped into place, and I got the same results as with your sample.

 

Email Pic (1).png

I have also got a link for the Power BI Desktop file.

https://1drv.ms/u/s!Apxn-69XhcAmhr5lR4KaCo8YNudFSQ





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Thanks for that. That has done the job for me.

Hi @andyt

 

Awesome glad we found a solution





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.