Forum Discussion

p-ha's avatar
p-ha
Frequent Visitor
7 years ago
Solved

Countif in Power BI

Hi all, I'm fairly new to Power BI and still trying to grasp the logic behind all the DAX and how to utilize them. Any help is greatly appreciated!   Here is my sample data table: PO Item # D...
  • dax's avatar
    7 years ago

    Hi p-ha,

     

    According to your description, it seems that you want to get below result, right(if count(po)>1, then show 1 in Year)?

    If so, you could use below measure to see whether it work or not

    Measure 5 =
    IF (
        CALCULATE (
            COUNT ( test[PO] ),
            FILTER (
                test,
                test[Item #] = MAX ( test[Item #] )
                    && test[Year] = MAX ( test[Year] )
            )
        ) > 1,
        1,
        0
    )

     

    Best Regards,

    Zoe Zhi

     

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

  • Ashish_Mathur's avatar
    7 years ago

    Hi,

    This measure works

    Measure = COUNTROWS(FILTER(SUMMARIZE(VALUES(Data[Item #]),Data[Item #],"ABCD",COUNTROWS(Data)),[ABCD]>1))+0

    Hope this helps.