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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
DanduMani104
Helper III
Helper III

DAX function

I have append table of 2022 and 2023 years from week 25 to week 31 and had column of Tour request number a as appended table ,but I want to show only week 31 data of 2023 and same period in last year of 2022 by sales offices and Y axis should contain no of tour request number in clustered column chart in power bi. what should I do to prepare clustered column chart.

 

Which DAX function Should I use to do this. The below chart is from EXCEl..I want do same in power bi desktop

 

DanduMani104_1-1696397982622.png

Plese Hep me

4 REPLIES 4
Sandhya1234
Helper II
Helper II

 

Make sure you have separate date/week table with Year, Week , YearWeek (YYYYWW) 

 

 

Have column like this in Date/week Table 

Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense)  //YYYYWW format

 

 

These measures can help
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

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

 

 

With date table you can also use

 

week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))  

 

Power BI — Week on Week and WTD   
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
  Time Intelligence, Part of learn Power BI 
https://youtu.be/cN8AO3_vmlY?t=27510

 

Power BI — WTD Questions— Time Intelligence 4–5

In this blog, we will try to answer, 10 Most Frequently Asked Questions on Week Till Date(WTD) in Power BI.

DanduMani104
Helper III
Helper III

No its not working ,

I have append table of 2022 and 2023 years week wise ,but I want to show only week 31 data of 2023 and same period in last year of 2022 by sales offices should be on X axis and Y axis should contain no of tour request number and Legend field should contain year column in clustered column chart in power bi without filtering data. what should I do to prepare clustered column chart. which  DAX function shoud I use

 

Make sure you have separate date/week table with Year, Week , YearWeek (YYYYWW) 

 

Have column like this in Date/week Table 

Week Rank = RANKX('Date','Date'[Year Week],,ASC,Dense)  //YYYYWW format

 

These measures can help
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

 

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

 

 

With date table you can also use

 

week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))  

 

Power BI — Week on Week and WTD   
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8
  Time Intelligence, Part of learn Power BI 
https://youtu.be/cN8AO3_vmlY?t=27510

 

 

Sandhya1234
Helper II
Helper II

@DanduMani104 Please try this measure. 

SameperiodLast Year = CALCULATE(Sum[Sales], DATEADD('Date', -1, YEAR)

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors