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
rohit_sharma2
Frequent Visitor

QoQ Calculation for Fiscal Quarter

Hi, I have fiscal Year/quarter starting from Feb, and in following format : 2018Q1 2018Q2 please help me on QoQ calculation, previous quarter and dateadd function doesnt work on custom calendar which i created according to my organization needs......it should display in following format: Quarer Sales Last Quarter 2018Q1 100 2018Q2 200 100 2018Q3 300 200
2 ACCEPTED SOLUTIONS
v-lili6-msft
Community Support
Community Support

hi, @rohit_sharma2

Does your custom calendar have no date column, just like this:

7.JPG

If so, you could try this way as below:

Step1:

Add a rank column for fiscal Year/quarter

rank = RANKX('calendar','calendar'[ fiscal Year/quarter],,ASC )

8.JPG

Note: You could add the rank column for the custom calendar according to the custom.

Step2:

Create a relationship between data table and custom calendar table

Step3:

Use this formula to add a measure

Measure = CALCULATE(SUM('Table'[value]), FILTER(ALL('calendar'),'calendar'[rank]=MAX('calendar'[rank])-1))

Result:

9.JPG

 

and here is pbix file, please try it.

If it is not your case, please share sample pbix file or some data sample and expected output. Do mask sensitive data before uploading

 

 

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

Hi Lin,

 

I tried your solution again, and it worked.

Thank youuuuuuuuuuuuuuuuuuu so muchhhhhhhhhhhhh.

 

Now other issue is apple to apple comparison, if in current quarter only 6 weeks have passed so wish to compare this with last quarter with 6 weeks data only.....please help me again.......

 

Regards

Rohit

View solution in original post

10 REPLIES 10
v-lili6-msft
Community Support
Community Support

hi, @rohit_sharma2

Does your custom calendar have no date column, just like this:

7.JPG

If so, you could try this way as below:

Step1:

Add a rank column for fiscal Year/quarter

rank = RANKX('calendar','calendar'[ fiscal Year/quarter],,ASC )

8.JPG

Note: You could add the rank column for the custom calendar according to the custom.

Step2:

Create a relationship between data table and custom calendar table

Step3:

Use this formula to add a measure

Measure = CALCULATE(SUM('Table'[value]), FILTER(ALL('calendar'),'calendar'[rank]=MAX('calendar'[rank])-1))

Result:

9.JPG

 

and here is pbix file, please try it.

If it is not your case, please share sample pbix file or some data sample and expected output. Do mask sensitive data before uploading

 

 

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.

Hi Lin,

 

I tried your solution again, and it worked.

Thank youuuuuuuuuuuuuuuuuuu so muchhhhhhhhhhhhh.

 

Now other issue is apple to apple comparison, if in current quarter only 6 weeks have passed so wish to compare this with last quarter with 6 weeks data only.....please help me again.......

 

Regards

Rohit

hi, @rohit_sharma2

What the form of week in you data, Please share some data sample and expected output. You can upload it to OneDrive and post the link here. Do mask sensitive data before uploading.

 

 

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.

Hi Lin,

 

Thank you.

My official work system doesnt allow me to save it on onedrive.

I will do it on my personal systeme and let you know.

 

One issue with Rankx function is it treats 1,10,11, 12,13  same when ranking the numbers because 10/11/12/13 starts with 1, see below, how to fix this

 

 

1---Rank Returned 1

2----6

3----7

4

5

6

7

8

9

10----2

11----3

12----4

13----5

 

hi, @rohit_sharma2

If this column is a text format, then rankx function will return the result like you described.

There are usually two ways:

1. Transform it from text to number

2. add the rank column manually instead of by rankx function.

 

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.

Hi Lin,

 

Please use this link to access sample file...its on same lines on what i have in database.

 

https://1drv.ms/u/s!AhWQcbvhekwKaf-RtVQA9S-_G3k

 

I have made custome calendar according to our requirements where :

 

1. Fiscal Year/1st Quarter Starts from Feb.

2. Fiscal Week Starts from Saturday till Friday.

 

Need solution on:

 

1. Calculation Week On Week growth rate, same logic is not happening as done for QoQ.

2. Also need to calculate Apples to Apples comparison for QoQ, for e.g. if current quarter we are in 10th week then it should compare with 10 weeks last quarter.

 

I am really grateful to you, i am receiving regular replies from you. It has been just 10-15 days i have started learning and using powerbi, i look forwar to learn more from you.

 

Regards

Rohit

hi, @rohit_sharma2

1. you could use this formula add a rank fiscal year week column

rank fiscal year week = RANKX(DateCalendar,DateCalendar[Fin Year]*100+DateCalendar[Fis Week Number],,ASC,Dense)

and use the same logic create a measure:

Last week Sales = CALCULATE([Total_Sales],FILTER(ALL(DateCalendar),DateCalendar[rank fiscal year week]=MAX(DateCalendar[rank fiscal year week])-1))

2. you could add a conditional in the basic formula as below:

NEW Last Qtr Sales = 
CALCULATE (
    [Total_Sales],
    FILTER (
        ALL ( DateCalendar ),
        (
            DateCalendar[rank quarter]
                = MAX ( DateCalendar[rank quarter] ) - 1
        )
            && ( DateCalendar[Week of Quarter] <= MAX ( DateCalendar[Week of 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.

1.Hi Lin, Hope you are doing great. I am stuck with how to show Actuals Vs Targets in tabular format , not getting everything correctly, please help me on getting the following view. I have already incorporated day wise targets in calendar and getting accurate results however want the below view: 2. 3. Thankyou very much...Rohit

 

DEPARTMENT AActualsTargets
Units9001,000
Rev (K)$1,500$2,000
Rec %45.0%50.0%
   
DEPARTMENT BActualsTargets
Units9001,000
Rev (K)$1,500$2,000
Rec %45.0%50.0%
   
DEPARTMENT CActualsTargets
Units9001,000
Rev (K)$1,500$2,000
Rec %45.0%50.0%
   
DEPARTMENT DActualsTargets
Units9001,000
Rev (K)$1,500$2,000
Rec %45.0%50.0%

Thank you a ton Lin....you are amazing....appreciate all your help...i will trouble you for more....i am learning a lot from you....

 

cheersSmiley Happy

Thank you Lin for quick response, i really appreciate this, however couldnt find the pbbix file but notes were helpful.

The solution is good, however not working for me.

 

I am unble to attach file as this forum doesnt have any option, kindly suggest me another way or if you can share your email address would be grateful to you.

 

Best Regards

Rohit

cnda.rohit28@gmail.com

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.