Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to calculate?

I have a table

I want calculate how many users in interval 25.03.2020 - 30.03.2020 have DateDiff(RefreshDate; ExchangeAct) = 0

  • Hi,

     

    According to your description, i create a simple sample to test:

    Then try this measure:

    Measure = 
    IF (
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                ALLSELECTED ( 'Table' ),
                'Table'[Name] IN DISTINCT ( 'Table'[Name] )
                    && 'Table'[ExchangeAct] <> 'Table'[RefreshDate]
            )
        ) > 0,
        1,
        0
    )

    The result shows:

    Here is my test pbix file:

    pbix 

    Hope this helps.

     

    Best Regards,

    Giotto Zhi

6 Replies

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    try a measure

     

    Measure = CALCULATE(DISTINCTCOUNT(Table[Name]); Table[ExchangeAct] = Table[RefreshDate]; DATESBETWEEN(Table[RefreshDate]; DATE(2020;3;25);DATE(2020;3;30)))

     

  • Create a measure


    measure =
    calculate(distinctcount(Table[Name]),filter(Table,DateDiff(Table[RefreshDate]; Table[ExchangeAct],day) = 0))


    or create a column and measure


    column = DateDiff(Table[RefreshDate]; Table[ExchangeAct],day)
    measure =
    calculate(distinctcount(Table[Name]),Table[Column] = 0)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks! But this is not a little not that.

      For example

      This user have a difference 1 day in 30.03.2020

      And this means that it should be excluded. Must get users who have in every day difference = 0

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        You have created a column, That will not suppress row. Create a measure and use in visuals.

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

    Hi,

     

    According to your description, i create a simple sample to test:

    Then try this measure:

    Measure = 
    IF (
        CALCULATE (
            COUNTROWS ( 'Table' ),
            FILTER (
                ALLSELECTED ( 'Table' ),
                'Table'[Name] IN DISTINCT ( 'Table'[Name] )
                    && 'Table'[ExchangeAct] <> 'Table'[RefreshDate]
            )
        ) > 0,
        1,
        0
    )

    The result shows:

    Here is my test pbix file:

    pbix 

    Hope this helps.

     

    Best Regards,

    Giotto Zhi