Forum Discussion

wpf_'s avatar
wpf_
Icon for Post Prodigy rankPost Prodigy
6 years ago
Solved

How to reset a measure value?

How do you set a one measure to a different value in different measure?  For example in the below measure:

 

Measure = 

 
If( CALCULATE([count]) = 3,

SUMX(VALUES(Table[Direction]), CALCULATE([Travel Times])),
BLANK()
)
 
How can i set [count] = 0 both when condition is true and false.  I want to reset it so when it calculates the next row, I want it to get a fresh value.  Currently it is accumulative. Thanks.
  • Hi wpf_ ,

     

    Please follow my steps to have a try.

    (Note: Please replace my [Total values] with you [count].)

     

     

    Total values = SUM('Table'[Values])
    Count Blank values =
    CALCULATE (
        COUNTROWS ( FILTER ( 'Table', [Total values] = 0 ) ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) )
    )
    

     

     

    Running totals =
    VAR curr = [Count Blank values]
    RETURN
        CALCULATE (
            'Table'[Total values],
            FILTER (
                ALL ( 'Table' ),
                'Table'[Date] <= MAX ( 'Table'[Date] )
                    && [Count Blank values] = curr
            )
        )
    

     

     

     

     

2 Replies

  • wpf_ not fully clear what is your question and what you are trying to achieve. Put some sample data and expected output.

     

     

  • v-xuding-msft's avatar
    v-xuding-msft
    Icon for Community Support rankCommunity Support

    Hi wpf_ ,

     

    Please follow my steps to have a try.

    (Note: Please replace my [Total values] with you [count].)

     

     

    Total values = SUM('Table'[Values])
    Count Blank values =
    CALCULATE (
        COUNTROWS ( FILTER ( 'Table', [Total values] = 0 ) ),
        FILTER ( ALL ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) )
    )
    

     

     

    Running totals =
    VAR curr = [Count Blank values]
    RETURN
        CALCULATE (
            'Table'[Total values],
            FILTER (
                ALL ( 'Table' ),
                'Table'[Date] <= MAX ( 'Table'[Date] )
                    && [Count Blank values] = curr
            )
        )