Forum Discussion

Gerald23's avatar
Gerald23
Icon for Helper I rankHelper I
4 years ago
Solved

Count value and filter by other column

Hi Everyone,

 

I have a table that looks like this:

 

Order DateOrder NumberCustomer NumberArticle NumberQualtity OrderedSold PriceNP

SoldPrice-NP

(This is a calculated Column)

1-1-202212301789310.8012.81-2.01
2-2-20221240279080.003.33-3.33
13-2-20221251078964.6612.81-8.15
14-2-20221261423053.342.510.83
16-2-20221302548612.401.061.34
18-2-2022140868522013.9918.95-4.96

 

Now i have created a measure to calculate the number of different items that are sold below the NP price that looks like this

 

Count #sold cheaper NP = CALCULATE(COUNT(Data[SoldPrice-NP]), Data[SoldPrice-NP] < 0)

 

 
But now I also want a measure that counts all articles that are sold below the NP price. So I need to count the values in the Quantity Ordered column but only when SoldPrice-NP is below 0. How could I achieve this?
 
 
 
  • That was easier then I expected xD

     

    I used the code below to achieve this

     

    Count all article below 0 = CALCULATE(SUM(Data[Quantity Ordered]), Data[SoldPrice-NP] < 0)

1 Reply

  • That was easier then I expected xD

     

    I used the code below to achieve this

     

    Count all article below 0 = CALCULATE(SUM(Data[Quantity Ordered]), Data[SoldPrice-NP] < 0)