cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
rashel2002 Regular Visitor
Regular Visitor

Help-How to change values to zero using measure on measure

Hi everyone!

 

i'm trying to create new column out of an existing column (cumulative column which was created by measure) - and change all the values that folowing the max value - to zero. here's an example-

 

17.PNG

 

Another option that might help is to keep the table as it is (not changing anything), BUT when i'm using the data to create "Line & stacked column chart" - it will look like we're using the right table.

 

thank you for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-yulgu-msft
Microsoft

Re: Help-How to change values to zero using measure on measure

Hi @rashel2002,

 

Since some rows have the same cumulative value with previous row, I assume the hour number for current WW is 0. So, I created below dummy data.

1.PNG        2.PNG

 

In such a scenario, please create measures:

cumulative No. of hours =
IF (
    SELECTEDVALUE ( 'Hour table'[WW] )
        > CALCULATE (
            LASTNONBLANK ( 'Hour table'[WW], 1 ),
            FILTER ( ALL ( 'Hour table' ), 'Hour table'[hours] <> 0 )
        ),
    0,
    CALCULATE (
        SUM ( 'Hour table'[hours] ),
        FILTER ( ALL ( 'Hour table' ), 'Hour table'[WW] <= MAX ( 'Hour table'[WW] ) )
    )
)

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Super User II
Super User II

Re: Help-How to change values to zero using measure on measure

can you post the original data table and syntax for the cumulative measure? Otherwise it's difficult to answer your question

Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Proud to be a Datanaut!

Microsoft v-yulgu-msft
Microsoft

Re: Help-How to change values to zero using measure on measure

Hi @rashel2002,

 

Since some rows have the same cumulative value with previous row, I assume the hour number for current WW is 0. So, I created below dummy data.

1.PNG        2.PNG

 

In such a scenario, please create measures:

cumulative No. of hours =
IF (
    SELECTEDVALUE ( 'Hour table'[WW] )
        > CALCULATE (
            LASTNONBLANK ( 'Hour table'[WW], 1 ),
            FILTER ( ALL ( 'Hour table' ), 'Hour table'[hours] <> 0 )
        ),
    0,
    CALCULATE (
        SUM ( 'Hour table'[hours] ),
        FILTER ( ALL ( 'Hour table' ), 'Hour table'[WW] <= MAX ( 'Hour table'[WW] ) )
    )
)

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors