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

how to subtract 2 data grids and get the result

i created a report using matric . below is the report.

Capture.JPG

 

 

 

 

 

 

 

i want a result set  some thing like below .  (Rev  - COGS by each line item )

Col1        col2               value  (CALC)

Subsidy   Sales            (RevSales - Cogs Sales)  (1579-1590)

                Auction        (RevAuction -COGS Auction)  (94474 -80504)

        

                

        

4 REPLIES 4
v-shex-msft
Community Support
Community Support

HI @dilipkumar,

Can you please share some dummy data with the same data structure as your original table for test? For your requirement, I think they need to do some transform on table structure by Dax formula or M query.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

An easy way to solve this is using a few measures in a row.  I'll show you how to create the "SALES" version, then you can create an equivelent for "Auction"

 

Step 1 is to create a basic "Sales" measure.  This will be something like

SALES = SUM('YourTable'[SalesAmount])

 

Step 2 is to create new measures that are pre-filtered to specific types of sales, using the Rev_Cogs column.  This will look like

REV Sales = CALCULATE(
	[SALES],
	'YourTable'[Rev_Cogs] = "Rev"
)

COGS Sales = CALCULATE(
	[SALES],
	'YourTable'[Rev_Cogs] = "COGS"
)

 

Step 3 is to make your final measure which will do the subtraction.  Something like:

Subsidy Sales = [REV Sales] - [COGS Sales]

so far so good. i was able to attain that. thanks you Ross. but if see here for line  eg ( allocations for rev) - (allocation for Cogs) i get the cal correct but the label should not be "Allocations" it should be "Net Allocations"  so do "Net Eqipment  incuurec"  and "net Equipment Allocated" ...

 
 

Capture.JPG

Anonymous
Not applicable

That looks like its coming directly out of your data.  If there is an issue in the data itself, you'll need to correct it.  This could be done as part of the import process.

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.