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
archienono
New Member

How to create a categorical column based on the quarterly growth of price?

Hi, 

 

I have sales data like the following:

DateProductPriceSales
2020.04.01AAA60600
2020.05.01AAA60900
2020.09.01AAA70700

 

I want to get a report based on the price changes:

CategoryTimeTotal Sales
New Sales2020Q21500
Price Increase2020Q3700

 

So far, I'm able to create new measures based on the quarterly price change:

 

	VAR __PREV_QUARTER =
		CALCULATE(
			AVERAGE('pricing'[price]),
			DATEADD('pricing'[date].[Date], -1, QUARTER)
		)
    VAR __NEXT_QUARTER =
        IF(DATEDIFF(LASTDATE(pricing[date].[Date]),TODAY(),QUARTER)>1,
            CALCULATE(
                AVERAGE('pricing'[price]),
                DATEADD('pricing'[date].[Date], 1, QUARTER)
            )
            ,1
        )
    VAR QuarterChange = AVERAGE('pricing'[price]) - __PREV_QUARTER
	RETURN
    IF(
        __PREV_QUARTER&&__NEXT_QUARTER,IF(QuarterChange>0,"Increase",IF(QuarterChange<0,"Decrease", "No change")),
            "New win / churn"

 

 

But the measures cannot be put as Rows header (my speculation is that measures needs the overall input from a table).

 

Can someone suggest what can be done in DAX to categorize the quarterly price change trend?

 

Thanks.

1 REPLY 1
lbendlin
Super User
Super User

You are mixing two slightly unrelated concepts.  One is the price change and the other is the quarterly view.

 

I would start by grouping events first by product price, and then by quarter, as price changes can happen multiple times in a quarter.

 

Please provide more comprehensive sample data if possible.

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.

Top Solution Authors