Forum Discussion
Total Sales calculation based on a dynamic flag that updates based on SELECTEDVALUE() date slicer.
- 3 years ago
UPDATE:
Was able to get the measure to work:
Net Sales := CALCULATE ( [Total Net Sales], FILTER ( 'FactSales', 'FactSales'[Date abc] <= SELECTEDVALUE('Date'[Week ending date]) ) )
Thank you for the reply!
[Flag] and 'FactSales'[Date Comp] <= SELECTEDVALUE ( 'DimDate'[week ending date] ) filters are the same. I just implemented the [Flag] logic within the measure itself since it didn't work well when I used it seperately. But they are basically the same, except that the former was created as a separate measure and the latter was used within the measure directly. I tried creating a [Flag] column in the fact table and implement it in the FILTER of the measure. But it results in a blank result.
NetSales :=
CALCULATE (
[Total Net SalesAmt],
FILTER ( 'FactSales', 'FactSales'[Flag] = 1 )
)
'FactSales'[Flag] is a calculated column with the following as the underlying DAX. This is the dynamic flag which changes based on the date slicer.
=IF('FactSales'[Date Comp] <= SELECTEDVALUE ('DimDate'[week ending date]), 1, 0)
This doesn't show any results in the visuals.
Thanks!