Forum Discussion

charlieH's avatar
charlieH
New Member
3 years ago
Solved

Date Comparison Incorrect Sometimes

I have three tables which contain dates, I have combined all of the unique dates into one date table. I am interested in creating a True/False condition where I can filter by the maximum date of one of our three tables. I calculate this max date as a measure where I just:

 

 

Measure = CALCULATE(MAX('Table 1'[Date]),'Table 1'[Fiscal Year] <= 2022)

 

 

 

 

So, now I create a column which checks if each row of our dates is less than our maximum date.

 

 

Check FY22 = if([Date] <= [Measure], True(), False())

 

 

 

 

This seems to create a bug where only those which dates are originally found only in Table 1 are filtered as expected. All other dates come in as False.

 

 

The measure used for filtering is returning this:

 

I've tried adding .Date to our date column and I'm getting the same results.

 

If I change our measure to just some defined static date, it works as expected which makes me think this is a bug of some sort?:

 

 

Measure = Date(2021, 9, 30)

 

 

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi charlieH,

    Measure and calculate column work on different levels, current you can't use filter/slicer effect to create a dynamic calculated column/table.
    When measures are used in the calculated column, the row and filter context will be fixed and affect the original measure formula calculation.

    Notice: the data level of power bi(from parent to child level)

    Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)

    Regards,

    Xiaoxin Sheng

2 Replies

  • I calculate this max date as a measure 

    What made you choose to implement this as a measure rather than a calculated column?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi charlieH,

    Measure and calculate column work on different levels, current you can't use filter/slicer effect to create a dynamic calculated column/table.
    When measures are used in the calculated column, the row and filter context will be fixed and affect the original measure formula calculation.

    Notice: the data level of power bi(from parent to child level)

    Database(external) -> query table(query, custom function, query parameters) -> data model table(table, calculate column/table) -> data view with virtual tables(measure, visual, filter, slicer)

    Regards,

    Xiaoxin Sheng