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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
felipesaw
Frequent Visitor

Dax or power query

Hello I need help to make this column "HELP"

 

If the value from "Value" to positive, just repeat that value in HELP.

If the value from "Value" to negative:

      -If the previous value value is positive, then I put the negative value in HELP.

      -If the last two values of negative values, i add both and put in HELP.

             - If the next value for positive discount this negative value or sum of negative values of HELP

 

 

DataValueHELP
01/jan/21100100
01/fev/21200200
01/mar/21-300-300
01/abr/21500200
01/mai/21100100
01/jun/21-200-200
01/jul/21-300-500
01/ago/211000500
01/set/21100100
1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @felipesaw 

Thanks for reaching out to us.

Just create 2 measures,

count = 
var _pre=MAXX(FILTER(ALL('Table'),'Table'[Data]<MIN('Table'[Data]) && 'Table'[Value]>=0),[Data])
return CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Data]>_pre && 'Table'[Data]<MIN('Table'[Data])))
Test = 
var _start=IF([count]<>BLANK(), MAXX(FILTER(ALL('Table'),'Table'[Data]<MIN('Table'[Data])&&ISBLANK([count])),[Data]))
var _sum=SUMX(FILTER(ALL('Table'),'Table'[Data]<=MIN('Table'[Data]) &&'Table'[Data]>=_start ),[Value])
return IF(ISBLANK([count]),MIN('Table'[Value]),_sum)

result

vxiaotang_0-1657525014991.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xiaotang
Community Support
Community Support

Hi @felipesaw 

Thanks for reaching out to us.

Just create 2 measures,

count = 
var _pre=MAXX(FILTER(ALL('Table'),'Table'[Data]<MIN('Table'[Data]) && 'Table'[Value]>=0),[Data])
return CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Data]>_pre && 'Table'[Data]<MIN('Table'[Data])))
Test = 
var _start=IF([count]<>BLANK(), MAXX(FILTER(ALL('Table'),'Table'[Data]<MIN('Table'[Data])&&ISBLANK([count])),[Data]))
var _sum=SUMX(FILTER(ALL('Table'),'Table'[Data]<=MIN('Table'[Data]) &&'Table'[Data]>=_start ),[Value])
return IF(ISBLANK([count]),MIN('Table'[Value]),_sum)

result

vxiaotang_0-1657525014991.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.