Forum Discussion

HenryJS's avatar
HenryJS
Post Prodigy
5 years ago
Solved

Matrix

Hi all,

 

How can I get a matrix with Week Ending along columns but link to a table with two different date fields?

 

As below I linked the calendar table to 'MOT Expires' but this causes the 'Service Due' field to fall into the wrong date on the matrix.

 

Please see below example for GXZ 2918. 

 

I would like to have a matrix with week endings along columns and be able to drop in date fields from multiple fields.

 

Vehicle Reg MOT expiresService Due 
DXZ 964221/01/202122/01/2021
EXZ 594625/06/202123/01/2021
EXZ 663702/06/202124/01/2021
EXZ 663811/06/202125/01/2021
EXZ 663925/10/202026/01/2021
EXZ 664003/06/202127/01/2021
GXZ 291827/09/202001/09/2020

 

 

 

 

 

 

5 Replies

  • HenryJS , Have a month or week table with dates . No need to join

    And use measures like this for these dates

    MOT expires measure = minx(filter(table,[MOT expires] <=Date[Date] && [Service Due] >= Date[Date]),[MOT expires] )
    Service Due measure = maxx(filter(table,[MOT expires] <=Date[Date] && [Service Due] >= Date[Date]),[Service Due] )

     

    The week on column   and Vehicle Reg  on row

     

    Calendar with week

    https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Power-BI-Turning/ba-p/1187482

    • HenryJS's avatar
      HenryJS
      Post Prodigy

      amitchandak it did not work with the measure you sent - please see below

       

      MOT expires measure = minx(filter('Vehicle Fleet Data',[MOT expires] <= 'calendar'[Date] && 'Vehicle Fleet Data'[Estimate Month Service Due] >= 'calendar'[Date]),'Vehicle Fleet Data'[MOT expires] )
       
      • amitchandak's avatar
        amitchandak
        Super User

        HenryJS , My mistake

        Try like

        MOT expires measure = minx(filter(table,table[MOT expires] <=max(Date[Date]) && table[Service Due] >= max(Date[Date])),table[MOT expires] )
        Service Due measure = maxx(filter(table,table[MOT expires] <=max(Date[Date]) && table[Service Due] >= max(Date[Date])),table[Service Due] )