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

Totalqtd not showing values for last week in quarter

Hey

 

I had a question a while ago but didn't get resolved

 

http://community.powerbi.com/t5/Desktop/totalqtd-not-returning-values-for-last-week-in-the-quarter/m...

 

basically I have data showing target values for each weke in the quarter. However when using the totalqtd function it calculates it correct for the first 12 weeks in the quarter but is blank for the 13th week. (e.g. 26/07/2018 - 01/07/2018).

 

Presumably this is down to it thinking the 1st is Q3 so doesn't register this week as Q2. However for us, the quarter starts on the first Monday so want to include. it. Is there a way to change this?

5 REPLIES 5
Greg_Deckler
Super User
Super User

Probably not, but this is why I created my Time Intelligence The Hard Way quick measure for these kinds of situations:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ 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...

Thanks Greg

 

What i do have is a separate file I uploaded containing date and quarter (with quarter when I want it to start/end each year). I feel I should be able to create a custom column/measure using this quarter but not quite figured out how.

Any chance you can post some sample data? The techniques I mentioned in my quick measures should work for this, but sample/example data allows me to get more specific about solutions. But, the main trick is to use VAR's to calculate your current quarter/month/year. Another VAR based on that to get your previous quarter/month/year. You use a SUMMARIZE to create a temp table in another VAR and from that you can use the MAXX, SUMX, AVERAGEX functions with a filter on that temp table to return the result you are looking for. But, it varies based upon the exact situation.


@ 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...

In the previous post (link in my original post above) there is some sample data that I made up. 

Sorry, seems like we went down this road before, that's the danger of doing stuff in your spare time, sometimes I lose track of threads. See the attached PBIX. I believe what you want is this (or something close):

 

Measure = 
VAR __currentWeek = MAX([Week])
VAR __currentQuarter = MAX([Quarter])
VAR __currentYear = MAX([Year])
VAR tmpTable = FILTER(ALL(Table1),[Year] = __currentYear && [Quarter]=__currentQuarter && [Week]<=__currentWeek)
RETURN SUMX(tmpTable,[Target]) 

I added the Index because your dates are different than the US and I was too lazy to fix them all.


@ 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.