Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a date table, a store table, and a sales table. I have relationships set up between the date table and sales table and the stores table and the sales table. In the table visual I am trying to create, I am trying to look at the total sales for each store on a single day this year and compare it to 364 days ago.
I've filtered the report page for a single day and added a table with a column for stores and two additional columns for measures. My measure for sales this year is CALCULATE(SUM(TransactionAmount)) and my measure for sales last year is CALCULATE(SUM(TransactionAmount), DATEADD(Dates[Date], -364, DAYS). The column for the current year's measure works fine. However, the column for last year's sales measure returns Blank for every store. However, the total for last year's sales across all stores is correct.
Thank you in advance.
Solved! Go to Solution.
Hi @lbamburoski ,
Try this measure:
last_364 =
VAR CurrentDATE =
MAX ( 'Calendar'[Date] )
RETURN
(
CALCULATE (
SUM ( SALES[sales]),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date]=CurrentDATE-364
)
)
)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @lbamburoski ,
Try this measure:
last_364 =
VAR CurrentDATE =
MAX ( 'Calendar'[Date] )
RETURN
(
CALCULATE (
SUM ( SALES[sales]),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date]=CurrentDATE-364
)
)
)
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@lbamburoski , is "dates" is marked as date table. Also Are you filter and axis/row/grouping of data from date table, whenever needed. My webinar link you can get pbix to download.
Please Watch/Like/Share My webinar on Time Intelligence: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
My Youtube Tips at: https://www.youtube.com/playlist?list=PLPaNVDMhUXGYrm5rm6ME6rjzKGSvT9Jmy
Appreciate your Kudos.
Try DATEADD(Dates[Date],-1,YEAR) instead. Also, you probably don't need the CALCULATE() around your current year measure.
If this works for you, please mark it as solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |