The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, I'm pretty new to PowerBI and I appreciate this forum to share experiences.
I've a problem with a measure not displaying the correct value. I've a fact table called Summary in which I've the field [Prepared Quantity] on wich I've created this measure:
Deliberated Lines TOT = CALCULATE(SUM('Summary'[Prepared Quantity]), GROUPBY('Summary','Summary'[Planned Delivery Date],'Summary'[Shipment Type],'Summary'[FLG Prep]))
where [Planned Delivery Date] is a non-unique field of type date.
What I would like to do is displaying the same value but one year before the selected date or the date in the visual row. I tried to use the SAMEPERIODLASTYEAR with [Planned Delivery Date] but it gave me an error because the date rows are not unique. So I added a calendar table in order to do that and I linked the [Planned Delivery Date Id] field to the calendar key of the calendar dimension. After that I've created this measure:
Deliberated Lines TOT Previous Year = CALCULATE('Summary'[Deliberated Lines TOT],ALL('Calendar'[Date Value]),SAMEPERIODLASTYEAR('Calendar'[Date Value]))
but it shows me the same value of the [Deliberated Lines TOT] measure.
Here's a screenshot:
What I'm doing wrong?
Thanks in advance
Solved! Go to Solution.
For Week in Year Number make sure tgat you select "Do not summarize" also make sure that 'Calendar' is marked as date table with Date Value as the date column. Then the following should technically work.
Deliberated Lines TOT Previous Year =
CALCULATE (
'Summary'[Deliberated Lines TOT],
ALL ( 'Calendar' ),
SAMEPERIODLASTYEAR ( 'Calendar'[Date Value] )
)
Hi @MarcoT
In your table visual, Instead of Planned Delivery Date please use 'Calendar'[Date] and instead of Week Planned Delivery Date use 'Calender'[Week Number]
Hi, I've done it but now but unfortunately it shows no results. Here's a screenshot:
For Week in Year Number make sure tgat you select "Do not summarize" also make sure that 'Calendar' is marked as date table with Date Value as the date column. Then the following should technically work.
Deliberated Lines TOT Previous Year =
CALCULATE (
'Summary'[Deliberated Lines TOT],
ALL ( 'Calendar' ),
SAMEPERIODLASTYEAR ( 'Calendar'[Date Value] )
)
User | Count |
---|---|
12 | |
9 | |
6 | |
6 | |
6 |
User | Count |
---|---|
24 | |
14 | |
14 | |
9 | |
7 |