Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Counting negative numbers in Power BI

Hi everyone, 

 

In Power BI data I have 3 columns named DTAT, Vendor Name, and Engine Model.

 

Is there anyway to count the number of negative values in DTAT and whether those negative numbers are specific to a vendor or an engine model in the Vendor Name & Engine Model columns?

 

Ex: 324 negative values in Vendor A; 120 negative values in Vendor B   OR  122 negative values in Engine A, etc.

 

[The 3 columns all have relationships with each other]

 

Thank you so much! Any help or suggestion is very much appreciated!

2 Replies

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

    Your general approach would be to use a FILTER condition.  Tying the counts to a specific vendor or engine is best done probably using visual filters on a card or table.

     

    NegCount  = CALCULATE( COUNT(Table[DTAT]), Table[DTAT] < 0 )
    
    or
    
    NegCount  = CALCULATE( COUNT(Table[DTAT]), 
        FILTER(Table, Table[DTAT] < 0 ) )

    Hope this helps

    David