Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
preethisaldanha
Frequent Visitor

Count the number of price changes

I have created a measure to caluclate the difference in price this month vs last month and now I want to count all the number of products that have had the price change, please can you advise how this can be done.

 

Price change = Calculate(IF([Previous Month]=0, 0,[Current Month]-[Previous Month]),'All detail'[Month] =  MAX('All detail'[Month]))

 

articleAugJuly
x105
y53
z1515
a1212
a107
c208

 

 
1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

To count the number of products that have had a price change, you can create a new measure that evaluates whether the "Price change" measure is not equal to 0 for each product. You can use the COUNTROWS function to count the rows where this condition is met. Here's how you can do it:

 

DAX Formula:

Price Change Count =
COUNTROWS(
FILTER(
SUMMARIZE('All detail', 'All detail'[article]),
[Price change] <> 0
)
)

 

This measure will count the number of products (articles) that have had a price change during the specified period. It uses the FILTER function to create a filtered table where the "Price change" measure is not equal to 0, and then COUNTROWS counts the rows in that filtered table.

Now, when you use the "Price Change Count" measure in your visualizations or tables, it will display the count of products with price changes for the given month.

View solution in original post

3 REPLIES 3
123abc
Community Champion
Community Champion

To count the number of products that have had a price change, you can create a new measure that evaluates whether the "Price change" measure is not equal to 0 for each product. You can use the COUNTROWS function to count the rows where this condition is met. Here's how you can do it:

 

DAX Formula:

Price Change Count =
COUNTROWS(
FILTER(
SUMMARIZE('All detail', 'All detail'[article]),
[Price change] <> 0
)
)

 

This measure will count the number of products (articles) that have had a price change during the specified period. It uses the FILTER function to create a filtered table where the "Price change" measure is not equal to 0, and then COUNTROWS counts the rows in that filtered table.

Now, when you use the "Price Change Count" measure in your visualizations or tables, it will display the count of products with price changes for the given month.

Thank you much appreciated. The solution worked.

You welcome.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.