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

how to show comparision of current and previous quarter in line chart (Overlap comparision)

Hi ,

 

 I have the following requirement where i need to show current and previous fiscal quarter comparision in Line chart.

 

My fiscal Year calendar is from July to June, So if i consider today i am in Q4 quarter and i need to compare Q4 with Q3.

 

Now i am using line chart and i am giving Month name in x axis and Current and prev quarter sales measures in Y axis. But since the quarters are different and months within each quarter are different i am seeing that the lines are not overlappiing and doesnt give me the Jist of comparision. Is there any way we can achieve this. 

 

Added sample image for reference.

 

Thanks,

Puneeth WhatsApp Image 2023-04-01 at 1.26.51 PM.jpeg

11 REPLIES 11
Ashish_Mathur
Super User
Super User

Hi,

I am confused,  If you want quarter wise comparison, then why are you dragging Months to the X-axis.  As if this was not enough, in the image you are showing weeks on the X-axis.  What exactly do you want? 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 

 

The image is just for reference The requirement is to bring in Months to the X-axis instead of weeks. 

 

I need to compare my current and previous quarter sales to overlap. Is there any way we can achieve this? Please let me know. 

 

Thanks,

Puneeth

 

 

 

 

 

Requirement is 

Hi,

Share some data to work with and show the result in a simple Table format.  Once we get the correct results in a Table, we can prepare whatever visual we want.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 

Please see the link below for sample data. Please let me know if this helps.

 

https://docs.google.com/spreadsheets/d/1M_iaMKsqT540mQm1mAZ4iHKXtE35KTq7/edit?usp=share_link&ouid=10...

 

Thanks

Puneeth

Access Denied message.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

You may download my PBI file from here.  You may drill down on the X-axis to see months on the X-axis as well.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur 

 

Thank you for your response. But, the requirement to compare my current and previous quarter sales to overlap. To showcase current and previous one over the other, not side by side. (as shown in reference first image)

 

Thanks

Puneeth

Hi,

Technically i don't think that is possible because the quarters have different months so the moment you drag Months to the x axis, the continuty for quarters breaks.  If you drag Quarters to the Legend, then this is what you get.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Puneethj
Frequent Visitor

Hi, @Greg_Deckler 

 

Thank you for your time in replying back. Below are the details as requested. 

 

Current Fiscal Quarter =
VAR Today =TODAY()
VAR FiscalYearStart = DATE(YEAR(Today), 7, 1)
VAR MonthsPassed = MONTH(Today) -7 +if( MONTH(Today)<7,12,0)
RETURN
IF(MonthsPassed > 0,
IF(MonthsPassed<=3,1,
IF(MonthsPassed <=6, 2,
IF(MonthsPassed <= 9, 3, 4))),
IF(MonthsPassed >= -9,4,
IF(MonthsPassed >= -12, 3,
IF(MonthsPassed >= -15, 2, 1)
)))

 

 

Current Quarter sales :  Calculate (sum(sales), filter ( date, date(quarter number) = current fiscal quarter]))

 

Previous Quarter sales: Var prev_quarter = [current fiscal quarter] - 1 

                                      return

                                      calculate (sum(sales), filter (date, date[quarter number] = prev_quarter

 

X-axis = Fiscal Short Month Name ( jan, feb, mar, etc. ) 

Y- axis = Current Quarter sales, Previous Quarter sales. 

 

Graph: Linechart. 

 

The above is the measure and calculations used.  Could you please check and let me know if you need anything else. 

Appreciate your time and help. 

 

Thanks

Puneeth 

Greg_Deckler
Super User
Super User

@Puneethj This is all going to come down to how you construct your measure for previous quarter. You can make it appear in the current quarter via DAX. Unfortunately, there's not enough information in this to really be specific around how to accomplish this.

 

Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.