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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.