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
JasMack
Frequent Visitor

Get a summary table from transaction table

Hi everyone,

 

I am new here.

 

I have a table which looks like this.

 

TeamPersonPeriodCostRevenue
ATom1100200
ATom2150100
AJack15090
AJack27580
BSarah1300400
BSarah2150500

 

Can you please help me with the achieving the following results on Power BI desktop using the table above?

 

ParticularPrior Month (Period <2)Year to date
Cost450825
Revenue6901370

 

Thanks.

 

Jason

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@JasMack Create a disconnected table like this:

Particulars = { "Cost", "Revenue" }

Create these measures:

Revenue YTD = SUM('Table'[Revenue])

Cost YTD = SUM('Table'[Cost])

Revenue Prior = SUMX(FILTER('Table',[Period] = 1), [Revenue])

Cost Prior = SUMX(FILTER('Table', [Period] = 1), [Cost])

Prior Month (Period < 2) = IF(MAX('Particulars'[Column1]) = "Cost", [Cost Prior], [Revenue Prior])

Year to Date = IF(MAX('Particulars'[Column1]) = "Cost", [Cost YTD], [Revenue YTD])

Put Column1 from Particulars in your table visual along with the last 2 measures.



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

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@JasMack Create a disconnected table like this:

Particulars = { "Cost", "Revenue" }

Create these measures:

Revenue YTD = SUM('Table'[Revenue])

Cost YTD = SUM('Table'[Cost])

Revenue Prior = SUMX(FILTER('Table',[Period] = 1), [Revenue])

Cost Prior = SUMX(FILTER('Table', [Period] = 1), [Cost])

Prior Month (Period < 2) = IF(MAX('Particulars'[Column1]) = "Cost", [Cost Prior], [Revenue Prior])

Year to Date = IF(MAX('Particulars'[Column1]) = "Cost", [Cost YTD], [Revenue YTD])

Put Column1 from Particulars in your table visual along with the last 2 measures.



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

Many thanks @Greg_Deckler .

 

But I have 2 more questions.

1. My result table automatically gets sorted alphabetically. Is there a way to stop that. For example: I would prefer to have "Revenue" instead of "Cost" as first row.

ParticularPrior Month (Period <2)Year to date
Cost450825
Revenue6901370

 

2. Suppose I need to have put the values in row revenue in percentage format. Is it possible?

 

Thank you again.

Jason

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors
Top Kudoed Authors