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.
Good morning,
I'm trying to capture the sales for a specified date. Based on the date I select, I want to capture the sales as of the last day in the month (2 months ago).
For example: If I select 11/20/2019. I want to return the sales for 9/30/2019.
For example: If I select 12/1/2019. I want to return the sales for 10/31/2019.
For example: If I select 1/1/2020. I want to return the sales for 11/30/2019.
I've tried several iterations but unable to get it to work. I do have a date table. An example below of a measure that did not work.
=CALCULATE(Sum(sales),Filter(All(Date),Date=EOMONTH(DATe,-2)
Thank you!
Solved! Go to Solution.
Hi Guys, thank you again for your help. I have figured out the correct solution for my custom needs.
It's CALCULATE (sum(Sales),PreviousDay(DATEADD('Date'[Date],-1,Month)))
Thank you again very much. Best regards - James
The first example seems wrong. Seem like you want 60 days behind
2 Months behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Month))
60 Days behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-60,Day))
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
@amitchandakHi, thank you for your help. Your response is close. It's providing a trailing value, either exactly 2 months ago or exactly 60 days ago. I'm trying to find the "End of Month" value for 2 months ago.
So for example: Today (1/21/2020) - I want to pull the sales for (11/30/2019).
Any tips?
Kindly - James
Hi Guys, thank you again for your help. I have figured out the correct solution for my custom needs.
It's CALCULATE (sum(Sales),PreviousDay(DATEADD('Date'[Date],-1,Month)))
Thank you again very much. Best regards - James
Hi @Jkaelin ,
Try this one (check table names and set proper ones if needed):
measure =
CALCULATE (
SUM ( 'Table name'[sales] ),
FILTER ( ALL ( 'Date' ), 'Date'[Date] = EOMONTH ( 'Date'[Date], -2 ) )
)
Please consider, following format for DAX calculations:
'Table' - for tables mention table in apostrophes
'Table'[Column] - for columns you need to mention table name (in an aforementioned format) and a column name with square brackets
[Measure] - measure name with square brackets without table name
Regards,
Ruslan Zolotukhin (zoloturu)
BI Engineer at Akvelon Inc. / Kharkiv Power BI User Group Leader / DAX & Power BI Trainer
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!
You are from Ukraine? If yes then welcome to Power BI User Group - KhPUG website. Other country? Check and find proper one - Power BI User Groups
@zoloturu Hi, thank you for the response. I appreciate the help. It appears the formula you provided is the same formula I posted in my question. For whatever reason, that doesn't work.
Best regards, James
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 |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |