Forum Discussion

MichaelaMul's avatar
MichaelaMul
Helper III
1 year ago
Solved

Count if Measure = certain value

Hi everyone,

I am trying to make a measure to count the number of NEW Distributions there was in the latest week. I have the following measure that indicates if it is NEW. Now I am trying to count the amount of rows that are "NEW".  Any ideas on how to change the measure? Below I have the measure that I have been trying to adjust to have it work, but currently it just shows zero.

VolSalesPP = CALCULATE(SUM('New Items_FINAL'[Volume Sales]),DATEADD('New Items_FINAL'[Date],-7,DAY))

NEW Distribution? = 
var VolSalesPW = CALCULATE(SUM('New Items_FINAL'[Volume Sales]),DATEADD('New Items_FINAL'[Date],-7,DAY))
VAR VolSales = SUM('New Items_FINAL'[Volume Sales])

RETURN
IF([VolSalesPP] = BLANK() && VolSales > 0,"NEW", BLANK())

Measure I have tried that doesn't work- I haven't added the latest week filter yet

# New Distribution = CALCULATE(SUMX ( VALUES ( 'New Items_FINAL'[Product] ), IF ( [NEW Distribution?] = "NEW", 1, 0 )), ALLSELECTED('New Items_FINAL'))

 

Sample Data below in comment:

  • Hi , Thank you for reaching out to the Microsoft Community Forum.

    I have reproduced your scenario in Power BI Desktop and successfully implemented a solution where we added a column to check if a product had sales this week but not the week before, marking it as a new distribution. Then we created a measure to count how many of these new distributions happened in the latest week. It returns 0 when there are none, and a number when new ones appear.

     

     

    For your reference, I’ve attached the working .pbix file.

     

    If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.

6 Replies

  • v-hashadapu's avatar
    v-hashadapu
    Community Support

    Hi , Thank you for reaching out to the Microsoft Community Forum.

    I have reproduced your scenario in Power BI Desktop and successfully implemented a solution where we added a column to check if a product had sales this week but not the week before, marking it as a new distribution. Then we created a measure to count how many of these new distributions happened in the latest week. It returns 0 when there are none, and a number when new ones appear.

     

     

    For your reference, I’ve attached the working .pbix file.

     

    If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.

  • Sample Data:

    New DistributionGeographyTimeProductVolume SalesVolume Sales Year AgoVolume Sales % Change vs PPDateLatestWeek?
     A StoreWeek Ending 06-29-25Creamer37.5 476.92%6/29/2025TRUE
    NEWA StoreWeek Ending 06-22-25Creamer6.5  6/22/2025FALSE
     A StoreWeek Ending 06-15-25Creamer   6/15/2025FALSE
     A StoreWeek Ending 06-08-25Creamer   6/8/2025FALSE
     A StoreWeek Ending 06-01-25Creamer   6/1/2025FALSE
     A StoreWeek Ending 05-25-25Creamer   5/25/2025FALSE
     A StoreWeek Ending 05-18-25Creamer   5/18/2025FALSE
     A StoreWeek Ending 05-11-25Creamer   5/11/2025FALSE
     A StoreWeek Ending 05-04-25Creamer   5/4/2025FALSE
     A StoreWeek Ending 04-27-25Creamer   4/27/2025FALSE
     A StoreWeek Ending 04-20-25Creamer   4/20/2025FALSE
     A StoreWeek Ending 04-13-25Creamer   4/13/2025FALSE
     A StoreWeek Ending 04-06-25Creamer   4/6/2025FALSE
     A StoreWeek Ending 03-30-25Creamer   3/30/2025FALSE
     A StoreWeek Ending 03-23-25Creamer   3/23/2025FALSE
     A StoreWeek Ending 03-16-25Creamer   3/16/2025FALSE
     A StoreWeek Ending 03-09-25Creamer   3/9/2025FALSE
     A StoreWeek Ending 03-02-25Creamer   3/2/2025FALSE
     A StoreWeek Ending 02-23-25Creamer   2/23/2025FALSE
     A StoreWeek Ending 02-16-25Creamer   2/16/2025FALSE
     A StoreWeek Ending 02-09-25Creamer   2/9/2025FALSE
     A StoreWeek Ending 02-02-25Creamer   2/2/2025FALSE
     A StoreWeek Ending 01-26-25Creamer   1/26/2025FALSE
     A StoreWeek Ending 01-19-25Creamer   1/19/2025FALSE
     A StoreWeek Ending 01-12-25Creamer   1/12/2025FALSE
     A StoreWeek Ending 01-05-25Creamer   1/5/2025FALSE
     A StoreWeek Ending 12-29-24Creamer   12/29/2024FALSE
     A StoreWeek Ending 12-22-24Creamer   12/22/2024FALSE
     A StoreWeek Ending 12-15-24Creamer   12/15/2024FALSE
     A StoreWeek Ending 12-08-24Creamer   12/8/2024FALSE
     A StoreWeek Ending 12-01-24Creamer   12/1/2024FALSE
     A StoreWeek Ending 11-24-24Creamer   11/24/2024FALSE
     A StoreWeek Ending 11-17-24Creamer   11/17/2024FALSE
     A StoreWeek Ending 11-10-24Creamer   11/10/2024FALSE
     A StoreWeek Ending 11-03-24Creamer   11/3/2024FALSE
     B StoreWeek Ending 06-29-25Creamer129.5 -7.66%6/29/2025TRUE
     B StoreWeek Ending 06-22-25Creamer140.25 -30.31%6/22/2025FALSE
     B StoreWeek Ending 06-15-25Creamer201.25 -26.75%6/15/2025FALSE
     B StoreWeek Ending 06-08-25Creamer274.75 81.95%6/8/2025FALSE
     B StoreWeek Ending 06-01-25Creamer151  6/1/2025FALSE
     B StoreWeek Ending 05-25-25Creamer151 3.42%5/25/2025FALSE
     B StoreWeek Ending 05-18-25Creamer146 0.52%5/18/2025FALSE
     B StoreWeek Ending 05-11-25Creamer145.25 12.16%5/11/2025FALSE
     B StoreWeek Ending 05-04-25Creamer129.5 -42.44%5/4/2025FALSE
     B StoreWeek Ending 04-27-25Creamer225 63.93%4/27/2025FALSE
     B StoreWeek Ending 04-20-25Creamer137.25 -10.44%4/20/2025FALSE
     B StoreWeek Ending 04-13-25Creamer153.25 -2.23%4/13/2025FALSE
     B StoreWeek Ending 04-06-25Creamer156.75 -1.26%4/6/2025FALSE
     B StoreWeek Ending 03-30-25Creamer158.75 -36.69%3/30/2025FALSE
     B StoreWeek Ending 03-23-25Creamer250.75 71.45%3/23/2025FALSE
     B StoreWeek Ending 03-16-25Creamer146.25 -3.15%3/16/2025FALSE
     B StoreWeek Ending 03-09-25Creamer151 0.50%3/9/2025FALSE
     B StoreWeek Ending 03-02-25Creamer150.25 -2.75%3/2/2025FALSE
     B StoreWeek Ending 02-23-25Creamer154.5 -4.33%2/23/2025FALSE
     B StoreWeek Ending 02-16-25Creamer161.5 -1.97%2/16/2025FALSE
     B StoreWeek Ending 02-09-25Creamer164.75 5.44%2/9/2025FALSE
     B StoreWeek Ending 02-02-25Creamer156.25 -22.55%2/2/2025FALSE
     B StoreWeek Ending 01-26-25Creamer201.75 144.55%1/26/2025FALSE
     B StoreWeek Ending 01-19-25Creamer82.5 -42.61%1/19/2025FALSE
     B StoreWeek Ending 01-12-25Creamer143.75 88.52%1/12/2025FALSE
    NEWB StoreWeek Ending 01-05-25Creamer76.25  1/5/2025FALSE
     B StoreWeek Ending 12-29-24Creamer   12/29/2024FALSE
     B StoreWeek Ending 12-22-24Creamer   12/22/2024FALSE
     B StoreWeek Ending 12-15-24Creamer   12/15/2024FALSE
     B StoreWeek Ending 12-08-24Creamer   12/8/2024FALSE
     B StoreWeek Ending 12-01-24Creamer   12/1/2024FALSE
     B StoreWeek Ending 11-24-24Creamer   11/24/2024FALSE
     B StoreWeek Ending 11-17-24Creamer   11/17/2024FALSE
     B StoreWeek Ending 11-10-24Creamer   11/10/2024FALSE
     B StoreWeek Ending 11-03-24Creamer   11/3/2024FALSE
    • Ashish_Mathur's avatar
      Ashish_Mathur
      Super User

      Hi,

      Based on the table that you have selected, what answer are you expecting?  Also, which of those columns are raw data columns?  Are you looking for an all measures solution?  What is the definition of a New Distributor?

  • MichaelaMul 

    what's the expected output? In your sample data, there is no new distribution in the lastest week. 

  • v-hashadapu's avatar
    v-hashadapu
    Community Support

    Hi MichaelaMul , hope you are doing great. May we know if your issue is solved or if you are still experiencing difficulties. Please share the details as it will help the community, especially others with similar issues.