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