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.
Hello Guys
i'm learning DAX and i was trying to make a measure for Sales Last year with Calculate and Filter
this formula works :
Sales LY =CALCULATE([Sales CY],SAMEPERIODLASTYEAR(Date[Date]))
Sales LY =CALCULATE([Sales CY],SAMEPERIODLASTYEAR(Date[Date]))
But when i add FILTER to the measure give me the values from the current year like "Sales CY"
Sales LY = CALCULATE([Sales CY], Filter (Date, SAMEPERIODLASTYEAR (Date[Date]) ))
I already have a date filter on the page relative date in this year
the invoices Table and Date table are joined on the date of the creation of the invoice (createat)
Data Model
also i don't get the weird shapes inside the blue circles
Any Help will much appreciated
HI @Homer,
Have you tried to use the date function to manually define filter range instead of time intelligence functions?
Time Intelligence "The Hard Way" (TITHW)
Regards,
Xiaoxin Sheng
@Homer , I hoping datedim is typo else
it need to like this ( I have not tested these)
Sales LY = CALCULATE([Sales CY], Filter (dim_date, dim_date[Date] in SAMEPERIODLASTYEAR (Date[Date]) ))
or
Sales LY = CALCULATE([Sales CY], Filter (Date, Date[Date] in SAMEPERIODLASTYEAR (Date[Date]) ))
Hey amit
i fixed the type and i tried your formula but it returned nothing ...
new Sales LY = CALCULATE([Sales CY], Filter ('Date','Date'[Date] in SAMEPERIODLASTYEAR('Date'[Date])))
@Homer , I checked on My data. This is not working.
The reason is that I can think of, is that the Filter tries to remove the data from the context. In the case of time intelligence, that is not needed.
Refer this http://dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/
i checked the article about the difference and that's why i wanted to use "FILTER" in my case ..
It should work but i don't have any ideas why it's not
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 | |
104 | |
77 | |
67 | |
63 |
User | Count |
---|---|
144 | |
107 | |
105 | |
82 | |
69 |