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.
Hi. Basically, I need the sales amount for the same period but last year. I'm putting this vales in cards so I failed to use the SAMEPERIODLASTYEAR function. I need to get a measure.
Thanks in advance.
Sales (Today-1) | DONE |
Monthly Sales | DONE |
Monthly Sales Last Year | UNDONE |
Sales from October 1st to (Today -1) | DONE |
Sales from October 1st Last year to (Today -1) Last year | UNDONE |
Solved! Go to Solution.
Hi @PDRTXRA ,
I created some data:
Here are the steps you can follow:
1. Create measure.
Sales (Today-1) =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]=TODAY()-1)
)
Monthly Sales =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]>= DATE(YEAR(TODAY()),MONTH(TODAY())-1,1) &&'Table'[Date]<=EOMONTH(TODAY(),-1)))
Monthly Sales Last Year =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]>= DATE(YEAR(TODAY())-1,MONTH(TODAY())-1,1)&&'Table'[Date]<=EOMONTH(TODAY(),-13)))
Sales from October 1st to (Today -1) =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]>=TODAY()-1&&'Table'[Date]<=DATE(YEAR(TODAY()),10,1)))
Sales from October 1st Last year to (Today -1) Last year =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]>=DATE(YEAR(TODAY())-1,MONTH(TODAY()),DAY(TODAY()))&&'Table'[Date]<=DATE(YEAR(TODAY())-1,10,1)))
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @PDRTXRA ,
I created some data:
Here are the steps you can follow:
1. Create measure.
Sales (Today-1) =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]=TODAY()-1)
)
Monthly Sales =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]>= DATE(YEAR(TODAY()),MONTH(TODAY())-1,1) &&'Table'[Date]<=EOMONTH(TODAY(),-1)))
Monthly Sales Last Year =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]>= DATE(YEAR(TODAY())-1,MONTH(TODAY())-1,1)&&'Table'[Date]<=EOMONTH(TODAY(),-13)))
Sales from October 1st to (Today -1) =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]>=TODAY()-1&&'Table'[Date]<=DATE(YEAR(TODAY()),10,1)))
Sales from October 1st Last year to (Today -1) Last year =
CALCULATE(SUM('Table'[rand]),FILTER(ALL('Table'),'Table'[Date]>=DATE(YEAR(TODAY())-1,MONTH(TODAY()),DAY(TODAY()))&&'Table'[Date]<=DATE(YEAR(TODAY())-1,10,1)))
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@PDRTXRA in case you have a proper date table (or just the autodate time table) then this measure should work:
Monthly Sales Last Year =
CALCULATE(
[Monthly Sales],
SAMEPERIODLASTYEAR('Date'[Date]
)
Please read this article to see you have everyhing in place:
https://www.daxpatterns.com/standard-time-related-calculations/
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 |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |