Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello, I'm new to Power BI and am working to offboard our company's reports from Chartio to Power BI!
Right now we have a table in Chartio that shows (dummy data). This updates every week with the relative date.
I'd like to recreate this in Power BI, but can't seem to find a clean way to build out this table. If I use a relative date slicer (i.e. last week), my table only shows last week's sales and I can't seem to add prior week, YTD, etc from other relative date slicers.
How would you recommend I go about building this out?
hi, @madeleinebell
For your case, you just need to use Time-intelligence functions to create the different measure for prior week, YTD, etc from other relative date slicers.
for example:
https://www.sqlbi.com/articles/week-based-time-intelligence-in-dax/
Best Regards,
Lin
Thanks @v-lili6-msft ! So in my raw data, I have a column that is "Week Beginning", as our data is all on a weekly basis.
Here are the DAX functions I've successfully created thus far:
I can't seem to figure out how to get the following, because we also use NRF weeks-- I do have a data column in my raw data that is NRF week as well if that would help?
hi, @madeleinebell
Sample data and expected output would help tremendously.
Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
Best Regards,
Lin
Thanks @v-lili6-msft Please see below for the sample data in the format we've imported it into Power BI. The table visual I want to build from this would be showing theaggregated retail revenue dollars for the retailer from Last Week, Week Prior, Year-to-Date This Year, and Year-to-Date Last year, then also showing the % difference for Week-over-Week, Last Week Year over Year, Last 4 Weeks Year over Year, and Year to Date Year over Year.
retailer | product | online or store | quarter | retail revenue | units sold | weeks per month (nrf) | week of month (nrf) | month number | year | week of year | week ending | week beginning |
Retailer A | Product 14 | Online | Q3 2018 | 1267 | 17 | 5 | 2 | 9 | 2018 | 36 | 9/15/2018 12:00:00 AM | 9/9/2018 12:00:00 AM |
Retailer A | Product 16 | Online | Q3 2018 | 802 | 16 | 5 | 2 | 9 | 2018 | 36 | 9/15/2018 12:00:00 AM | 9/9/2018 12:00:00 AM |
Retailer A | Product 16 | Online | Q3 2015 | 1240 | 97 | 5 | 2 | 9 | 2015 | 36 | 9/12/2015 12:00:00 AM | 9/6/2015 12:00:00 AM |
Retailer A | Product 6 | Store | Q3 2018 | 618 | 88 | 5 | 5 | 9 | 2018 | 39 | 10/6/2018 12:00:00 AM | 9/30/2018 12:00:00 AM |
Retailer A | Product 21 | Online | Q3 2018 | 233 | 85 | 5 | 5 | 9 | 2018 | 39 | 10/6/2018 12:00:00 AM | 9/30/2018 12:00:00 AM |
Retailer A | Product 4 | Store | Q3 2017 | 442 | 71 | 5 | 1 | 9 | 2017 | 35 | 9/9/2017 12:00:00 AM | 9/3/2017 12:00:00 AM |
Retailer A | Product 18 | Online | Q3 2018 | 1111 | 49 | 5 | 4 | 9 | 2018 | 38 | 9/29/2018 12:00:00 AM | 9/23/2018 12:00:00 AM |
Retailer A | Product 6 | Online | Q3 2018 | 279 | 58 | 5 | 1 | 9 | 2018 | 35 | 9/8/2018 12:00:00 AM | 9/2/2018 12:00:00 AM |
Retailer A | Product 9 | Online | Q3 2018 | 252 | 49 | 5 | 1 | 9 | 2018 | 35 | 9/8/2018 12:00:00 AM | 9/2/2018 12:00:00 AM |
Retailer A | Product 24 | Online | Q3 2018 | 776 | 78 | 5 | 1 | 9 | 2018 | 35 | 9/8/2018 12:00:00 AM | 9/2/2018 12:00:00 AM |
Retailer A | Product 13 | Online | Q3 2017 | 112 | 43 | 5 | 3 | 9 | 2017 | 37 | 9/23/2017 12:00:00 AM | 9/17/2017 12:00:00 AM |
Retailer A | Product 15 | Store | Q3 2017 | 1351 | 59 | 5 | 3 | 9 | 2017 | 37 | 9/23/2017 12:00:00 AM | 9/17/2017 12:00:00 AM |
Retailer A | Product 8 | Store | Q3 2018 | 690 | 91 | 5 | 3 | 9 | 2018 | 37 | 9/22/2018 12:00:00 AM | 9/16/2018 12:00:00 AM |
Retailer A | Product 7 | Online | Q3 2017 | 594 | 23 | 5 | 2 | 9 | 2017 | 36 | 9/16/2017 12:00:00 AM | 9/10/2017 12:00:00 AM |
Retailer A | Product 14 | Online | Q3 2017 | 1230 | 65 | 5 | 2 | 9 | 2017 | 36 | 9/16/2017 12:00:00 AM | 9/10/2017 12:00:00 AM |
Retailer A | Product 18 | Online | Q3 2017 | 1370 | 90 | 5 | 2 | 9 | 2017 | 36 | 9/16/2017 12:00:00 AM | 9/10/2017 12:00:00 AM |
Retailer A | Product 5 | Online | Q3 2017 | 1808 | 4 | 5 | 2 | 9 | 2017 | 36 | 9/16/2017 12:00:00 AM | 9/10/2017 12:00:00 AM |
Retailer A | Product 21 | Online | Q3 2017 | 569 | 64 | 4 | 1 | 8 | 2017 | 31 | 8/12/2017 12:00:00 AM | 8/6/2017 12:00:00 AM |
Retailer A | Product 9 | Online | Q3 2018 | 1378 | 77 | 4 | 1 | 8 | 2018 | 31 | 8/11/2018 12:00:00 AM | 8/5/2018 12:00:00 AM |
Retailer A | Product 5 | Online | Q3 2019 | 18 | 9 | 4 | 1 | 8 | 2019 | 31 | 8/10/2019 12:00:00 AM | 8/4/2019 12:00:00 AM |
Retailer A | Product 28 | Online | Q3 2019 | 1006 | 0 | 4 | 1 | 8 | 2019 | 31 | 8/10/2019 12:00:00 AM | 8/4/2019 12:00:00 AM |
Retailer A | Product 16 | Online | Q3 2015 | 1406 | 14 | 5 | 1 | 9 | 2015 | 35 | 9/5/2015 12:00:00 AM | 8/30/2015 12:00:00 AM |
Retailer A | Product 16 | Store | Q3 2016 | 206 | 30 | 4 | 4 | 8 | 2016 | 34 | 9/3/2016 12:00:00 AM | 8/28/2016 12:00:00 AM |
Retailer A | Product 14 | Online | Q3 2017 | 1156 | 97 | 4 | 4 | 8 | 2017 | 34 | 9/2/2017 12:00:00 AM | 8/27/2017 12:00:00 AM |
Retailer A | Product 15 | Store | Q3 2017 | 642 | 12 | 4 | 4 | 8 | 2017 | 34 | 9/2/2017 12:00:00 AM | 8/27/2017 12:00:00 AM |
Retailer A | Product 15 | Online | Q3 2018 | 1427 | 15 | 4 | 4 | 8 | 2018 | 34 | 9/1/2018 12:00:00 AM | 8/26/2018 12:00:00 AM |
Retailer A | Product 21 | Store | Q3 2018 | 74 | 50 | 4 | 4 | 8 | 2018 | 34 | 9/1/2018 12:00:00 AM | 8/26/2018 12:00:00 AM |
Retailer A | Product 16 | Store | Q3 2015 | 840 | 73 | 4 | 4 | 8 | 2015 | 34 | 8/29/2015 12:00:00 AM | 8/23/2015 12:00:00 AM |
Retailer A | Product 33 | Store | Q3 2018 | 1830 | 75 | 4 | 3 | 8 | 2018 | 33 | 8/25/2018 12:00:00 AM | 8/19/2018 12:00:00 AM |
Retailer A | Product 8 | Online | Q3 2018 | 1729 | 94 | 4 | 3 | 8 | 2018 | 33 | 8/25/2018 12:00:00 AM | 8/19/2018 12:00:00 AM |
Retailer A | Product 16 | Online | Q3 2017 | 1390 | 83 | 4 | 1 | 7 | 2017 | 27 | 7/15/2017 12:00:00 AM | 7/9/2017 12:00:00 AM |
Retailer A | Product 15 | Store | Q3 2018 | 1696 | 30 | 4 | 1 | 7 | 2018 | 27 | 7/14/2018 12:00:00 AM | 7/8/2018 12:00:00 AM |
Retailer A | Product 16 | Online | Q3 2019 | 388 | 30 | 4 | 1 | 7 | 2019 | 27 | 7/13/2019 12:00:00 AM | 7/7/2019 12:00:00 AM |
Retailer A | Product 10 | Online | Q3 2019 | 1458 | 60 | 4 | 1 | 7 | 2019 | 27 | 7/13/2019 12:00:00 AM | 7/7/2019 12:00:00 AM |
Retailer A | Product 16 | Online | Q3 2016 | 1130 | 11 | 4 | 4 | 7 | 2016 | 30 | 8/6/2016 12:00:00 AM | 7/31/2016 12:00:00 AM |
Retailer A | Product 8 | Online | Q3 2017 | 1133 | 97 | 4 | 4 | 7 | 2017 | 30 | 8/5/2017 12:00:00 AM | 7/30/2017 12:00:00 AM |
Retailer A | Product 21 | Online | Q3 2017 | 1008 | 19 | 4 | 4 | 7 | 2017 | 30 | 8/5/2017 12:00:00 AM | 7/30/2017 12:00:00 AM |
Retailer A | Product 13 | Online | Q2 2016 | 495 | 98 | 5 | 5 | 6 | 2016 | 26 | 7/9/2016 12:00:00 AM | 7/3/2016 12:00:00 AM |
HI, @madeleinebell
You could try this way:
Step1:
Create a date table, then create the relationship with basic data table by [week beginning]
Step2:
Create the measure as below:
Last Week = CALCULATE(SUM('Table'[retail revenue]),DATEADD('Date'[Date],-7,DAY))
lastyear last year = CALCULATE([Last Week],SAMEPERIODLASTYEAR('Date'[Date]))
and here is sample pbix, please try it.
Best Regards,
Lin
User | Count |
---|---|
102 | |
90 | |
80 | |
71 | |
70 |
User | Count |
---|---|
114 | |
100 | |
97 | |
72 | |
71 |