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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Kemalnugraha
Frequent Visitor

Calculate YTD with Yearweek slicer

Hi,

 

need help with this, i need to calculate YTD value measure in Table "Unit Sold" but using slicer yearweek,

in this "Unit Sold" table also i create many other measure as well

i have date table reference consist of date and year week column in "Calendar table"

i find the solution using date in slicer with before type slicer like this :

 

Kemalnugraha_0-1652854326902.png

 

but using yearweek the slicer with before type wont show

any other method how to solved this?

 

 

i already try using 2 slicer, 1 year week slicer, 1 date slicer, 

i remove all interaction for year week slicer for all visual in page except interaction to date slicer

it work  only to date slicer but the date slicer wont filter the entire visual data

5 REPLIES 5
isabella
Microsoft Employee
Microsoft Employee

Hi @Kemalnugraha 

I think you can use measure like this:

Measure = TOTALYTD( SUM([Quantity]),'Calendar'[Date] )

I add  a chart and date slicer on page

isabella_0-1653033657207.png

 

 

Here is my line chart settings

isabella_1-1653033657208.png

 

 

Best Regards,

Community Support Team _Isabella

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

i must change every measure used in all slide? and add calculate filter

amitchandak
Super User
Super User

@Kemalnugraha , if you have a calendar table and week year is selected

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))

 

 

or like this

 

YTD= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Week] <= Max('Date'[Week]) ))


LYTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Week] <= Max('Date'[Week])))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

that mean i must change every measure used in all slide?

the year week format already defined YYYMM

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.