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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
1up
Resolver I
Resolver I

Sum column field pairs by year and add the Total as new column field names

Hi,

 

I'd like to use a measure and Sum two entity pairs existing in the same column. Each Sum I'd like to present with a new name, please find example below.

 

All my fields exist in the same table. I get a correct result using Calculate and Sum and Containstring, however it

1) Shows the same result for all entities (there are like 25 in total in the full list), and

2) I would like the measure to add new Row fields for the totals so it is easy to see the breakdown and total for each region. If anyone suggest to present this in another way it is welcomed as well of course.

 

RegionSalesYear
Europe1002019
Europe Extra1052019
North America1102019
North America Extra1232019
Europe1102020
Europe Extra942020
North America1252020
North America Extra1302020
   
   
Wanted Result  
 Sales
Region20192020
Europe100110
Europe Extra10594
Europe Total205204
North America110125
North America Extra123130
North America Total233255
1 ACCEPTED SOLUTION
edhans
Super User
Super User

This is a simple measure @1up 

Total Sales = SUM('Table'[Sales])

It returns this:

edhans_0-1613515867320.png

The key is to set your model up properly. I added a date to your sales table. I just made the year be Dec 31 of that year.

edhans_1-1613515924017.png

The location table is a DIM table that explains how to summarize the data:

edhans_2-1613515970657.png

The Year field in the visual comes from the Date table, not your sales table. That column doesn't even exist anymore - you can see the Power Query code behind me converting that ot a date and getting rid of the Year itself.

edhans_3-1613516138994.png

Here is my PBIX file.

This is the date table I used - http://bit.ly/DateTableByEd

The key is the DAX is as simple as it could be with a good model. This is a Star Schema, and what Power BI expects. It is designed for it. Microsoft Guidance on Importance of Star Schema

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

4 REPLIES 4
edhans
Super User
Super User

This is a simple measure @1up 

Total Sales = SUM('Table'[Sales])

It returns this:

edhans_0-1613515867320.png

The key is to set your model up properly. I added a date to your sales table. I just made the year be Dec 31 of that year.

edhans_1-1613515924017.png

The location table is a DIM table that explains how to summarize the data:

edhans_2-1613515970657.png

The Year field in the visual comes from the Date table, not your sales table. That column doesn't even exist anymore - you can see the Power Query code behind me converting that ot a date and getting rid of the Year itself.

edhans_3-1613516138994.png

Here is my PBIX file.

This is the date table I used - http://bit.ly/DateTableByEd

The key is the DAX is as simple as it could be with a good model. This is a Star Schema, and what Power BI expects. It is designed for it. Microsoft Guidance on Importance of Star Schema

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thank you! Yes a solid model really help things along nicely.

1up
Resolver I
Resolver I

Thank you for edhans-ing my initial model and for the pedagogic explanation. Good learnings.

Cheers, 1up

Glad to help @1up - Power BI is super easy to use when getting started, but sometimes the best solution is a good model. Then the DAX becomes much easier. Have fun with Power BI! ๐Ÿ˜



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (27)