the point is that I want to calculate the sum of sales for the current month and see the result from the year before
devFactSprzedaz[Data] - column with date
devFactSprzedaz[Sprzedaż netto] - sales column
devDimArtykul[Nazwa Magazynu] - column with stores list used for filtering specific stores
so I have two measures. The first one to calculate the sales value for the current month and this one work well all the time:
MTD = TOTALMTD(SUM(devFactSprzedaz[Sprzedaż netto]),devFactSprzedaz[Data])
and another to calculate same but year ago:
MTD LY = CALCULATE(TOTALMTD(SUM('devFactSprzedaz'[Sprzedaż netto]),'devFactSprzedaz'[Data]),SAMEPERIODLASTYEAR('devFactSprzedaz'[Data]))
without any filters, everything works ok !
the problem is when applied filters using devDimArtykul[Nazwa Magazynu] in right pane:
if I choose some stores from the list. the value of my second measure displays such an error:
Solved! Go to Solution.
Ok so i created Date Table:
now the error does not appear, but the output for my MTD LY is incorrect, I get too large amount. and I don't know where it comes from because the measure looks ok
MTD LY = CALCULATE(TOTALMTD(SUM('devFactSprzedaz'[Sprzedaż netto]),'devFactSprzedaz'[Data]),SAMEPERIODLASTYEAR(DateKey[Date]))
as far as I know it should work even if I use a smart date and then I don't need this date table but the result is the same:
Smart Date Measure
MTD LY = CALCULATE(TOTALMTD(SUM('devFactSprzedaz'[Sprzedaż netto]),'devFactSprzedaz'[Data]),SAMEPERIODLASTYEAR('devFactSprzedaz'[Data].[Date]))
in both cases my measure returns 12.72M and it show sum for period 2020-12-01 to 2020-12-31 but why??
also I calculated desired period manually and it should be : 3.94M
where am i making a mistake ?
Some Time Intelligence functions expect a continuous distinct date column to work with. A common and recommended practice is to use a Date table. Refer to below links to understand more about date table and modify your model accordingly.
Community Support Team _ Jing Zhang
Hi @luke050 , @DataInsights ,
Also, to use Time Intelligence functions the date table must be contiguous and cover the whole period that you are calculating.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Check out new user group experience and if you are a leader please create your group!
On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks
Check out how to claim yours today!