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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.