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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
sokg
Solution Supplier
Solution Supplier

Help with Line chart shows current TOTALQTD and Last Year same TOTALQTD

Hello to all,

 

I have  Sales = SUM(SalesValue). I have a date table with dates from 1/1/2016.

 

I have created QTDSales= TOTALQTD([Sales],DATESQTD(dCalendar[Date])) and

PY QTDSales = CALCULATE([QTDSales],DATEADD(dCalendar[Date],-1,YEAR))

and I want to see only current QTD compared with LY QTD.

Instead I see all QTD’s.

What am I doing wrong????

 

Thanks in advance

1 ACCEPTED SOLUTION
sokg
Solution Supplier
Solution Supplier

I fix it using these formulas:

 

QTDSales = CALCULATE(TOTALQTD([Sales];DATESQTD(dCalendar[Date]));dCalendar[Quarter No]=ROUNDUP(MONTH(TODAY())/3;0);dCalendar[Year]=YEAR(TODAY()))

 

and

 

PY QTDSales = CALCULATE([Sales];DATEADD(DATESQTD(dCalendar[Date]);-1;YEAR);dCalendar[Quarter No]=ROUNDUP(MONTH(TODAY())/3;0);dCalendar[Year]=YEAR(TODAY())-1)

 

Thank you all, for your replies.

View solution in original post

6 REPLIES 6
sokg
Solution Supplier
Solution Supplier

I fix it using these formulas:

 

QTDSales = CALCULATE(TOTALQTD([Sales];DATESQTD(dCalendar[Date]));dCalendar[Quarter No]=ROUNDUP(MONTH(TODAY())/3;0);dCalendar[Year]=YEAR(TODAY()))

 

and

 

PY QTDSales = CALCULATE([Sales];DATEADD(DATESQTD(dCalendar[Date]);-1;YEAR);dCalendar[Quarter No]=ROUNDUP(MONTH(TODAY())/3;0);dCalendar[Year]=YEAR(TODAY())-1)

 

Thank you all, for your replies.

vanessafvg
Super User
Super User

@sokg

 

can you provide a screen shot of your data that is wrong?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Capture1.JPG

I want to see only the last quarter. The part from 1/4/2017 till today.

@sokg

QTD doesn't refer to the latest quarter as far as i know it just rolls it up at a quarter level

 

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Yes i know that, but i there any way to show only the last quarter?

Hi @sokg,

You can create a new table including date column, then create a calculated column using the formula.

last Quarter = CALCULATE(MAX('Newtable'[Quarter]),ALLEXCEPT('Newtable','Newtable'[Year]))

Then create a measure get the min day of the last quarter in current year.

Min day = CALCULATE(MIN('Newtable'[Date]),FILTER('Newtable','Newtable'[Year]=MAXX(ALL('Newtable'),'Newtable'[Year])&&'Newtable'[Quarter]='Newtable'[last Quarter]))

Then create another measure using the formula.

Year-to-quarter = CALCULATE(Sales[Year-to-Quarter],FILTER('Sales','Sales'[Date]>=Newtable[Min day]))

To display part of the value, which is similar with the rolling days part in this thread.

Best Regards,
Angelia

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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