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
Miska
Helper I
Helper I

Need to append running difference between two categories in a row in a report table

Hi!

 

I have a report table where there is a first column with different categories and followed by Current Month amount, previous month amt, YTD amounts . I need to append a new row in the report which will show me the difference between two categories when the report is refreshed.

CategoryCY AmtPY AmtYTD Amt
Sales42435664356
Cost534564747575
Salary53456644577567
Expenses54345668678
Oveheads646446458678

1

 

I want to create a new row within the same table which will show me a new category with a difference between the Sales and the cost as Gross Profit

 

Something like this:

 

CategoryCY AmtPY AmtYTD Amt
Sales42435664356
Cost534564747575
Gross Profit-1102-810-7219
Salary53456644577567
Expenses54345668678
Oveheads646446458678

 

Any help will be greatly appreciated

 

Thanks

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Miska ,

 

In PowerBI, the newly added data exists in the form of rows, and different dax are created to calculate different columns. I did the following test. I need to transpose the rows and columns in the power query first, and then create a measure in the desktop to calculate the Gross Profit for the sales column and the cost column.

v-henryk-mstf_1-1621221614815.png

 

Gross-Profit = MAX('Table (2)'[Sales])-MAX('Table (2)'[Cost])

v-henryk-mstf_0-1621221563423.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @Miska ,

 

In PowerBI, the newly added data exists in the form of rows, and different dax are created to calculate different columns. I did the following test. I need to transpose the rows and columns in the power query first, and then create a measure in the desktop to calculate the Gross Profit for the sales column and the cost column.

v-henryk-mstf_1-1621221614815.png

 

Gross-Profit = MAX('Table (2)'[Sales])-MAX('Table (2)'[Cost])

v-henryk-mstf_0-1621221563423.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

We have like Category and subcategories under the categories so it will be like around 100 subcategories and couple million records for this. I tried it but does not seem to work .

 

Thanks

Hi @Miska ,

 

What is the specific error display, transpose the rows and columns in the power query should not affect the calculation. Can you provide detailed test data model information (delete sensitive information), I will answer you as soon as possible.


Looking forward to your reply.

Best Regards,
Henry

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.