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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Need help in calculating POS with mentioned conditions. Files are attached.

 Please find the sample file in below location:
https://drive.google.com/drive/folders/1Ut7HHoIQmuvU8qj-U2vC8Tid-Mooz9qY?usp=sharing

@amitchandak 
Need help in creating this complex measure.

Condition:

Formula is POS= Top1-nve cumulative + pve Cumulative

But if the result is negative then we replace the value with 0
and for the next row formula has to be POS= 0- POS_nve +POS_pve
Suppose if we do not get negative value for the above row then cumulation has to start from that point.

Please find the expecetd result column from the excel sheet attached

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

You cannot do this as a measure. You cannot even do this as a calculated column.  The only way you can do that is in Power Query.

 

Table.AddColumn(
  #"Added Index", 
  "Result", 
  each List.Accumulate(
    {1 .. [Index]}, 
    #"Added Index"[POS Top1]{0}, 
    (state, current) =>
      List.Max({0, 
                state + #"Added Index"[POS_pVE]{current} - #"Added Index"[POS_nVE]{current}
               })
  )
)

 

 

See attached.

 

View solution in original post

You cannot do this as a measure

Please let me know how I can formulate that statement more convincingly.  SUMX does not allow for conditional resets. Only List.Accumulate has that feature.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Please suggest if this can be solved by a measure. I cannot implement the solution in power query. 

You cannot do this as a measure

Please let me know how I can formulate that statement more convincingly.  SUMX does not allow for conditional resets. Only List.Accumulate has that feature.

lbendlin
Super User
Super User

You cannot do this as a measure. You cannot even do this as a calculated column.  The only way you can do that is in Power Query.

 

Table.AddColumn(
  #"Added Index", 
  "Result", 
  each List.Accumulate(
    {1 .. [Index]}, 
    #"Added Index"[POS Top1]{0}, 
    (state, current) =>
      List.Max({0, 
                state + #"Added Index"[POS_pVE]{current} - #"Added Index"[POS_nVE]{current}
               })
  )
)

 

 

See attached.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors