Forum Discussion
DAX - Help with FILTER - ALL option
I have a DAX query below (QUERY1) where I am trying to display data fomr current week and data from prior week. Prior week is defined as "Actual GI Time Intelligence Fiscal Week Key -10" and the corresponding data as "Delivery Net Weight Quantity -10" and "Item Net Weight Quantity -10". The results for the prior week comes out as null.
However, when I create a new query (QUERY2) with same parameter for the specifc prior week, I get data.
Attaching screen shots from DaxStudio of both queries with results.
//QUERY1
//-----------
evaluate
(
summarize
(
calculatetable
(
'DELIVERY ITEM'
,'_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key] = 667
)
,'_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key]
,"Delivery Net Weight Quantity",[Delivery Net Weight Quantity]
,"Item Net Weight Quantity",[Item Net Weight Quantity]
,"Actual GI Time Intelligence Fiscal Week Key -10",'_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key]-10
,"Delivery Net Weight Quantity -10",
calculate
(
[Delivery Net Weight Quantity],
filter(ALL('_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key]),
'_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key] = '_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key]-10)
)
,"Item Net Weight Quantity -10",
calculate
(
[Item Net Weight Quantity],
filter(ALL('_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key]),
'_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key] = '_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key]-10)
)
)
)
//QUERY2
//-----------
evaluate
(
summarize
(
calculatetable
(
'DELIVERY ITEM'
,'_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key] = 657
)
,'_ACTUAL GI DATE'[Actual GI Time Intelligence Fiscal Week Key]
,"Delivery Net Weight Quantity",[Delivery Net Weight Quantity]
,"Item Net Weight Quantity",[Item Net Weight Quantity]
3 Replies
- v-diye-msft
Community Support
Hi jtc900502 ,
Could you please share your dummy pbix here? Or the simple worksheet with serveral expected results.
That would be easier for us to provide the valuable advice.
- jtc900502New Member
I don't really have a dummy PBIX, just working in DAX to setup the dataset before creating an SSRS report. It was just a general question on how to properly create a measure for a prior week data. I tried using filter ALL and CalculateTable but to no avail.
- v-diye-msft
Community Support
Hi jtc900502 ,
I can barely imagine your data with your formula thus i can hardly provide the accurate suggestion. if you want to calculate the prior week data, please kindly refer to the similar post:
https://community.powerbi.com/t5/Desktop/To-fetch-previous-week-data/td-p/276276
https://community.powerbi.com/t5/Desktop/Measure-displaying-last-week-sum/td-p/495437https://community.powerbi.com/t5/DAX-Commands-and-Tips/Sales-amount-previous-week-snapshot/td-p/136315