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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
DarylRob
Helper I
Helper I

DAX : Pivot a table to get totals

So I've got the below table imported. 

 

NameRegionProject NameTotal MRRTotal Hours
AndyUS 1005
TrevorUK 20010
AndyUS 30015
TrevorUK 400

20

SandyUS 500

25

 

I then want to be able to create a calculated table that will come out as below

 

RegionNameTotal MRRTotal Hours
USAndy40020
UKTrevor60030
USSandy50025

 

So I basically just want ot pivot up the totals of each person. 

 

I'm new to Power BI so don't know where to start

 

Thanks, 

1 ACCEPTED SOLUTION
bcdobbs
Super User
Super User

If you did specifically want a calculated table you could do this:

bcdobbs_2-1640199289719.png

SummaryTable = 
SUMMARIZECOLUMNS(
    MainTable[Region],
    MainTable[Name],
    "Total Hours", CALCULATE ( SUM ( MainTable[Total Hours] ) ),
    "Total MRR", CALCULATE ( SUM ( MainTable[Total MRR] ) )
)


Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

It looks like you want a visual and not a calculated table.  If that is the case, do this.  To your Table/matrix visual, drag Region and Name.  Write these measures:

MRR total = sum(Data[Total MRR])

Hours = sum(Data[Total hours])

Hope this helps. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks Asish, but I then want to be able to put this into a line chart to show progression over time, which wouldnt work with this would it?

Hi,

For that you must have a Date column in your dataset as well.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
bcdobbs
Super User
Super User

If you did specifically want a calculated table you could do this:

bcdobbs_2-1640199289719.png

SummaryTable = 
SUMMARIZECOLUMNS(
    MainTable[Region],
    MainTable[Name],
    "Total Hours", CALCULATE ( SUM ( MainTable[Total Hours] ) ),
    "Total MRR", CALCULATE ( SUM ( MainTable[Total MRR] ) )
)


Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Now i've got another table that's got Q1, Q2, Q3, Q4 row data in how would I bring that into this? Call it table2 and its as below

 

NameQuarterMRR QuotaHours Quota
AndyQ1100050
AndyQ2200050
AndyQ3300050
AndyQ4400050

This is perfect, thank you

bcdobbs
Super User
Super User

Hi,
Do you specifically need a calculated table or just want a visual to display a table like that?

If the later just drop the columns into a table visual like this:

bcdobbs_0-1640198972502.png

 

Power Bi by will guess what agregation you want for a numeric column but you can check it by clicking the down arrow on a field after you drop it into a viusal:

bcdobbs_1-1640199118753.png

 

Can send the DAX over if you specifically want a calculated table.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Hi, 

I forgot to include the date columns that i'll also have (Q1, Q2, Q3, Q4) which I then want to be able to show in a line chart. Which I don't think I can do via this method?

Can you mock up a demo pbix file and send it. Think even bringing dates in you can keep it simple maybe with the addition of a date table. Might be missing something though.



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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