The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
The issue is that I am trying to get Week over Week % AND the ability to use Page Filters to affect the totals. First off, just getting the correct sales from last week is giving me problems.
By using these DAX codes, I am missing the "lastWeekRetailSales" for 01/11/2021, which is sales from 01/04/2021 and they do exist.
lastWeekRetailSales = CALCULATE( SUM('Query_Data'[Retail_Sales]), DATEADD('Query_Data'[Start_Date],-7,DAY) )
lastWeekRetailSales =
CALCULATE (
SUM ( 'Query_Data'[Retail_Sales] ),
FILTER (
ALLSELECTED('Query_Data'),
'Query_Data'[Start_Date]
= MAX('Query_Data'[Start_Date]) - 7
)
)
This DAX code provides me with all the Sales from Last Week, but it NOT affected by the Page Filter.
lastWeekRetailSales2 =
CALCULATE (
SUM ( 'Query_Data'[Retail_Sales] ),
FILTER (
ALL('Query_Data'),
'Query_Data'[Start_Date]
= SELECTEDVALUE('Query_Data'[Start_Date]) - 7
)
)
What am I missing? TIA
Solved! Go to Solution.
ALLSELECTED by definition will not allow you to access periods that are filtered. You need to use ALL. Also, you don't seem to have a calendar table. You should always use a calendar table for time intelligence https://exceleratorbi.com.au/power-bi-calendar-tables/
when you use ALL(calendar[date]), it should work.
ALLSELECTED by definition will not allow you to access periods that are filtered. You need to use ALL. Also, you don't seem to have a calendar table. You should always use a calendar table for time intelligence https://exceleratorbi.com.au/power-bi-calendar-tables/
when you use ALL(calendar[date]), it should work.
After building your Calendar, I'm in business. Thanks Matt!
User | Count |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
36 | |
14 | |
12 | |
7 | |
7 |