Forum Discussion

viesturs's avatar
viesturs
Regular Visitor
3 years ago
Solved

time intelligence power bi date functions not working with measures as arguments

I have a table TNS_dati with sales volumes [Cena Euro] and date column [Datums / Periods] and related calendar table "calender" as date table. I am trying to calculate sales for all the period except the last month and found very tricky thing :

 

1. when I am harcoding the date : 

Vecie klienti = CALCULATE(
              SUM(TNS_dati[Cena EURO]),
               FILTER(
                   Calender,
                 //   TNS_dati[Datums / Periods] < DATE(YEAR(max(TNS_dati[Datums / Periods])),3,1)
                       Calender[Date] < date(2023, 2,29)
                //  DATESBETWEEN(TNS_dati[Datums / Periods], blank(), max(TNS_dati[Datums / Periods])
                  //  DATESINPERIOD(Calender[Date], min(Calender[Date]),13,MONTH)
                     )
            )
It works perfectly and returns what I am looking for, but when I am using a measure (for instance for year = 
 YEAR(max(Calender[Date])), It returns for 2023 ok but for all the previous years only Jan, Feb.
 
Could someone explain why it is so and how to solve it?
 
 
 

1 Reply