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.
Question for those DAX Gurus amoung us.
I have the measures in place for YTD Sales and Last YTD Sales. These return values that are spot on but I want more. What I would like to create is a measuer for Last YTD that cuts off the calculations based upon yesterday's date so that I can plug it in to my reports and not have to worry about updating filters to cut off the data for a particular user who wants up-to-date sales figures. As of now, it pulls in last year YTD sales through the end of my filter. So, if I am filtering by the month it pulls in through the end of the month where I only want last years sales through the current date.
Is it possible to build this to pull the last invoiced date found in the sales information and back that up a year so that I don't have to add granular filters?
My Sales table is tied to my date table by both Order Date and by Posting Date. Posting Date uses USERELATIONSHIP.
For YTD Invoiced Sales I am using: =TOTALYTD([Total Sales by Posting Date], DimDate[DateKey])
For Last YTD Sales I am using : =CALCULATE([Invoiced Sales YTD], DATEADD(DimDate[DateKey], -1, year))
Proud to be a Super User!
I calculate columns for today, previous month, year, day, etc., in the date's table. Put this columns in filters and your reports evolves in time.
Can you do something like:
=CALCULATE([Invoiced Sales YTD], DATEADD(DimDate[DateKey], -1, year) && DimDate[DateKey] < TODAY()) Or perhaps =CALCULATE([Invoiced Sales YTD], DATEADD(DimDate[DateKey], -1, year), DimDate[DateKey] < TODAY())
@Greg_Deckler I tried to use your formula it works well when you have CARD visuals, but when I have table chart with states having 5 years data. it gives me all data and I am supposed to get only last year current month data.
How to achieve this.
Thanks,
Thimma
Can you post some sample data so that I can play with the solution?
Thanks for the reply, but I am not able to attach any file here.
Thanks,
Thimma
Pls refer the screenshot, but my output should be as below
and even I don't need 2015 and 2014 as I am comparing current vs previous years
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |