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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.