Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DAX - Count only Positive Change from Last Year ( file attached)

Hi,

 

I am trying to count how many names have positive changes from last year.


I can manage to:
1) create a measure for the Revenue from the previous year (called Revenue Last Year)
2) create a measure for the difference between 2 years (called changes) 
3) identify at row-level which name has positive changes (called positive count) - but pretty sure it is not correct!

 

The problem is the Total supposed to 2, not 5.... 

 

Note:

- I have read through the posts regarding Measure Totals but none of them is involved time intelligence measure like my case. (The only similar case I found, there is no solution!! )
- Hoping to see DAX solution for a calculated measure, not calculated column, please.

 

I guess it is something to do with time intelligence and blank (because some years there is no data).

Here is the pbix file  - https://drive.google.com/open?id=1psK-p7VV1-5YDP7NW-BJMVLYeB262djw



Thanks 

  • Hi Anonymous 

     

    Try the below 

    positive count = 
    COUNTROWS(
        FILTER(
            VALUES( Revenue[Name] ),
            [change] > 0
        )
    )
    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

2 Replies

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

    Hi Anonymous 

     

    Try the below 

    positive count = 
    COUNTROWS(
        FILTER(
            VALUES( Revenue[Name] ),
            [change] > 0
        )
    )
    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Mariusz,


      Thank you!!! I can't believe I didn't try that... I guess I still don't truely understand DAX.. :smileyvery-happy: