Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Delta Values, within subgroup (skip in between subgroups)

2020-12-21_10-13-10.jpgHi,

 

I have a calculation for delta-values for subgroups that is fine within each group - however whenever there is a new subgroup the calculation is not able to differentiate,

 

How would I manange the calculation to handle the in between subgroups as well?

Where the calculation sasys 9.936.002 I would like to have zero - since the next line is a new subgroup (column "MeterTagID"),

 

 

 

Data_P16 = 
var _nextvalue=
CALCULATE(SUM('DataLog_P16'[Data]),FILTER('DataLog_P16',[Indeks]=EARLIER('DataLog_P16'[Indeks.1])))
var _data=
_nextvalue-[Data]
return IF(_nextvalue=BLANK(),BLANK(),_data)

 

 

 

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

@Anonymous You need to add meter tag matching: 

 

Data_P16 = 
var _nextvalue=
CALCULATE(SUM('DataLog_P16'[Data]),FILTER('DataLog_P16', [MeterTagID] = EARLIER('DataLog_P16'[MeterTagID]) && [Indeks]=EARLIER('DataLog_P16'[Indeks.1])))
var _data=
_nextvalue-[Data]
return IF(_nextvalue=BLANK(),BLANK(),_data)

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try like

 

Data_P16 = 
var _nextvalue=
CALCULATE(SUMX(FILTER('DataLog_P16',[Indeks]=EARLIER('DataLog_P16'[Indeks.1] && [MeterTagID]=EARLIER('DataLog_P16'[MeterTagID]), 'DataLog_P16'[Data])))
var _data=
_nextvalue-[Data]
return IF(_nextvalue=BLANK(),BLANK(),_data)
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AllisonKennedy
Super User
Super User

@Anonymous You need to add meter tag matching: 

 

Data_P16 = 
var _nextvalue=
CALCULATE(SUM('DataLog_P16'[Data]),FILTER('DataLog_P16', [MeterTagID] = EARLIER('DataLog_P16'[MeterTagID]) && [Indeks]=EARLIER('DataLog_P16'[Indeks.1])))
var _data=
_nextvalue-[Data]
return IF(_nextvalue=BLANK(),BLANK(),_data)

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors