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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
MrAnderson72
Frequent Visitor

Return a calculated Value from a conditional and filtered maxx

Hello,

I have the table below and the following situation, please help me!

  • The table is extracted from the DB (except for the last column, which is the expected result)
  • I have a process where the Total is the number of non conformities (NCs) found into an Assessment
  • The following Assessment are linked with the original one by the column "ID" (same number)
  • I need to have a column with the number of NC reduced from last assessment (Initial Assessments are always zero)
  • Basically, current line "Total" minus last assessment "Total" (same ID and highest SubID # from all the Sub IDs that are lower from the current one)
  • The "Sub ID" is sequential but based on all the rows.

I tried to use MAXX with Filter, but with no success. Please, show me the way for solving this!!!

 

    (Expected Result)
IDSub IDTotalAssessmentReduction
116Initial0
155Post1
1124Post1
1172Post2
228Initial0
267Post1
2182Post5
385Initial0
3152Post3
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@MrAnderson72 , Create a new column

new column =
var _min = maxx(filter(Table, [ID] =earlier([ID]) && [Sub ID] < earlier([Sub ID])),[Sub ID])
var _2 =maxx(filter(Table, [ID] =earlier([ID]) && [Sub ID] =_min),[Total])
return
if(isblank(_2), 0,_2-[Total])

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

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@MrAnderson72 , Create a new column

new column =
var _min = maxx(filter(Table, [ID] =earlier([ID]) && [Sub ID] < earlier([Sub ID])),[Sub ID])
var _2 =maxx(filter(Table, [ID] =earlier([ID]) && [Sub ID] =_min),[Total])
return
if(isblank(_2), 0,_2-[Total])

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.