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
PeterChen
Helper I
Helper I

Create measure to calculate year quarter growth rate

I have a data looks like this:  

Date          F1      F2       Value
2014/1/1      A       A1         0.5
2014/1/1      A       A1         0.5
2014/5/1      A       A1         1
2015/1/3      A       A1         0.6
2015/3/5      A       A1         0.6
2015/4/3      A       A1         1.4
2014/3/1      B       B5         0.3
2014/3/2      B       B5         0.7
2014/6/1      B       B5         1
2015/1/3      B       B5         0.7
2015/3/9      B       B5         0.7
2015/6/3      B       B5         1.5

I want to create a measure to calculate the growth rate, so I can create dynamic plot and table in the report tab and it will automatically calculate the growth rate if I change the Date to hierarchy, year and quarter, or add one more column, F1 or F2, to the values.

 

 

1 ACCEPTED SOLUTION

hi, @PeterChen 

DATEADD is Time-intelligence function, It's better use a complete dim date table in calculation.

Create a dim date table, then create a relationship with basic data table

9.JPG

And then use dim fields from dim table instead of data table.

And I would recommend you learn DAX first.

https://www.sqlbi.com/p/introducing-dax-video-course/

https://www.sqlbi.com/books/the-definitive-guide-to-dax/

Please understand that this link is provided “AS IS” with no warranties or guarantees of content changes, and confers no rights.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi, @PeterChen 

You could use DATEADD Function to create a measure as below:

Measure = 
	VAR __PREV_QUARTER = CALCULATE(SUM('Table'[Value]), DATEADD('Date'[Date], -1, QUARTER))
	RETURN
		DIVIDE(SUM('Table'[Value]) - __PREV_QUARTER, __PREV_QUARTER)

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


@v-lili6-msft wrote:

hi, @PeterChen 

You could use DATEADD Function to create a measure as below:

Measure = 
	VAR __PREV_QUARTER = CALCULATE(SUM('Table'[Value]), DATEADD('Date'[Date], -1, QUARTER))
	RETURN
		DIVIDE(SUM('Table'[Value]) - __PREV_QUARTER, __PREV_QUARTER)

Best Regards,

Lin


What does this come from? How did you create 'Date'? Could you please explain more on it?

'Date'[Date]

 

hi, @PeterChen 

DATEADD is Time-intelligence function, It's better use a complete dim date table in calculation.

Create a dim date table, then create a relationship with basic data table

9.JPG

And then use dim fields from dim table instead of data table.

And I would recommend you learn DAX first.

https://www.sqlbi.com/p/introducing-dax-video-course/

https://www.sqlbi.com/books/the-definitive-guide-to-dax/

Please understand that this link is provided “AS IS” with no warranties or guarantees of content changes, and confers no rights.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.