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
Anonymous
Not applicable

Subtracting Total Value

Hi Team,

 

DAX function for subtract total value -limt and remaining value reflect all size rows like z1 (26.9-9.8 and remaining value 17.1) see output table

screen.PNG

 

 

Below table is output file (after subtrating data for total size -Limit )

Remaining Val is (ex. z1 is 26.9 subtract with limit (z1 - 9.8) and remaining value reflect all z1 rows)

 

screen_II.PNG

 

 

 

 

Thanks,

KV's

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a new column like

sumx(filter(table, [size] = earlier([size]) ),[Qas(m)]) - maxx(filter(table, [size] = earlier([size]) ),[Limit])

 

or a measure like

sumx(filter(allselected(table), [size] = max([size]) ),[Qas(m)]) - maxx(filter(allselected(table), [size] = max([size]) ),[Limit])

View solution in original post

2 REPLIES 2
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

There are two ways:

Here are the steps you can follow:

The first method:

1. Create measure.

Remaining Val =
var _1=CALCULATE(SUM('Table'[Qas]),FILTER(ALL('Table'),'Table'[size]=MAX('Table'[size])))
var _2=CALCULATE(MAX('Table'[Limit]),FILTER(ALL('Table'),'Table'[size]=MAX('Table'[size])))
return _1 -_2

2. Result.

2020.12.153.png

The second method:

1. Create Calculated table.

table1 =
SUMMARIZE('Table','Table'[size],
'Table'[Desc],
"Limit",CALCULATE(MAX('Table'[Limit])),
"Remaining Val",CALCULATE(SUM('Table'[Qas]),FILTER(ALL('Table'),'Table'[size]=MAX('Table'[size])))-CALCULATE(MAX('Table'[Limit]),FILTER(ALL('Table'),'Table'[size]=MAX('Table'[size]))))

2. Result.

2020.12.154.png

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

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

amitchandak
Super User
Super User

@Anonymous , Try a new column like

sumx(filter(table, [size] = earlier([size]) ),[Qas(m)]) - maxx(filter(table, [size] = earlier([size]) ),[Limit])

 

or a measure like

sumx(filter(allselected(table), [size] = max([size]) ),[Qas(m)]) - maxx(filter(allselected(table), [size] = max([size]) ),[Limit])

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.