Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hi,
trying to get a PY measure. the following dax works already, but when a filter on specific sub-periods is set (months or weeks), the output is the full (previous) year value anyway. what's wrong with this script?
these are the used tables/columns:
'Dim_Tempo'[DataISO] : Time table, column is the yyyy/mm/dd date.
'Fact_Sales'[SellIN_EUR] : Values to sum depending on the set monthly/weekly filters.
SellIn_EUR_PY =
VAR CurrentYear = YEAR(MAX('Dim_Tempo'[DataISO]))
VAR PrevYear = CurrentYear - 1
RETURN
CALCULATE(
SUM('Fact_Sales'[SellIN_EUR]),
FILTER(
ALL('Dim_Tempo'),
YEAR('Dim_Tempo'[DataISO]) = PrevYear &&
'Dim_Tempo'[DataISO] <= MAX('Dim_Tempo'[DataISO])
)
)
thank you!
Solved! Go to Solution.
No it isn't (Tables are set by IT Dept People and I have norole in that). But it seems I've just solved this by myself. The Dax I used to make it work is :
And the table itself is also set as a date table? 😄
No it isn't (Tables are set by IT Dept People and I have norole in that). But it seems I've just solved this by myself. The Dax I used to make it work is :
Hi,
I think this one might work for you:
That's a good one, but maybe is not fitting to the formats of my tables, because syntax is correct but I can'g get any value when applied to my dataset, tho.
Thank you for the hint.
Hmm, okay. It should work given you have 1:N relationship with Dim_Tempo->Fact_Sales
Did you mark your Dim_Tempo as a date table?
Yes, both relationship is 1:N and Dim_Tempo DataIso is set as a date. Relation among the tables is through a common Key field ID_Date with the same numeric format yyyymmdd.
Dim_Tempo is a table also including Year, half, quarter, month, week, day as numeric fields...
This is definitely blowing my mind (i am a rookie, tho). 🙂
User | Count |
---|---|
15 | |
10 | |
9 | |
9 | |
8 |