Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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). 🙂
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |