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.
Hi everyone,
How can I compare same week in different year if I have only year and week number in my data set, I don't dave date column?
Thank you in advance,
Milena
Solved! Go to Solution.
@Anonymous
Typically same week is 364 days behind
Week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,Day))
You can also refer this file which use week rank -https://www.dropbox.com/s/d9898a48e76wmvl/sales_analytics_weekWise.pbix?dl=0
The same week would be 52 ranks less or you can use
Also you can modify this formula and use
Measure TD =
var _max = maxx(table[Week])//format of 201901
var _week = right([WeekYear],2)
var _year= left([WeekYear],4)
return
calculate(table[Value], filter(all(Table), Table[Year]=_year && Table[week No] <=_week))
Measure LTD =
var _max = maxx(table[Week])//format of 201901
var _week = right([WeekYear],2)
var _year= left([WeekYear],4)-1
return
= calculate(table[Value], filter(all(Table), Table[Year]=_year&& Table[week No] <=_week))
@Anonymous
Typically same week is 364 days behind
Week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,Day))
You can also refer this file which use week rank -https://www.dropbox.com/s/d9898a48e76wmvl/sales_analytics_weekWise.pbix?dl=0
The same week would be 52 ranks less or you can use
Also you can modify this formula and use
Measure TD =
var _max = maxx(table[Week])//format of 201901
var _week = right([WeekYear],2)
var _year= left([WeekYear],4)
return
calculate(table[Value], filter(all(Table), Table[Year]=_year && Table[week No] <=_week))
Measure LTD =
var _max = maxx(table[Week])//format of 201901
var _week = right([WeekYear],2)
var _year= left([WeekYear],4)-1
return
= calculate(table[Value], filter(all(Table), Table[Year]=_year&& Table[week No] <=_week))
@amitchandak I think you missed the point or I could be totally wrong, @Anonymous there is no date column in her model, just year and week.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Anonymous try this, again might need tweaking, add a measure
Prev Year and Week =
VAR __PrevYear = MAX ( Table[Year] ) - 1
VAR __Week = MAX ( Table[Week] )
RETURN
CALCULATE ( SUM ( Table[Amount] ), ALL ( Table ), Table[Year] = __PrevYear, Table[Week] = __Week )
replace table and column name as per your model.
Would appreciate Kudos 🙂 if my solution helped.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
96 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
88 | |
63 |