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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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