Forum Discussion

mjairus's avatar
mjairus
New Member
3 years ago

Comparing row value with column value and returning a value if there is a match

Hi,


I have not been able to find my answers within the threads. Of note, LOOKUP doesn't seem to help with the matching and returning of values for me. This is quite tricky for me as real dates aren't being used but rather strings.

 

Here are the two datasets I am working with. The first table is called Projects.

ProjectPlanning Start TimePlanning End TimeExecution Start TimeExecution End Time
Creating a GardenQ1 WY22Q2 WY22Q2 WY22Q4 WY22

Renovating Bedroom

Q1 WY23Q3 WY23Q4 WY23Q1 WY26
Final Year ResearchQ3 WY23Q1 WY24Q2 WY24Q4 WY24

 

Next, I have a 'date' table called dimDate that contains all the Q/WY linked to dates:

DateQ_WY
01/01/2022Q1 WY22
02/01/2022Q1 WY22
03/01/2022Q1 WY22
......
01/04/2022Q2 WY22
......


My aim is to create a matrix that is able to capture this info, similar to a Gantt Chart. Currently, I am using a matrix, and the rows is from Project['Project Name'], and the column values from dimDate['Q_WY']. If the Q/WY of the Project matches with the calendar Q/WY dates, the cell should return a value of 1, if not, returns 0. See below for example. What measure should I create for the Values column to enable this?

 

Project NameSub-taskQ1 WY22Q2 WY22Q3 WY22Q4 WY22Q1 WY23...
Creating a GardenPlanning11000...
 Execution00110...

Renovating Bedroom

Planning

00001...

 

Execution

00000...
Final Year ResearchPlanning00000...
 Execution00000...

 

Thank you so much!

2 Replies

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Icon for Community Support rankCommunity Support

    Hi mjairus ,

     

    I can't reproduce this expected result table for the time being, can you further explain your requirements and provide test data so that I can answer for you as soon as possible.


    Looking forward to your reply.


    Best Regards,
    Henry

     

  • Aburar_123's avatar
    Aburar_123
    Icon for Solution Supplier rankSolution Supplier

    Hi mjairus ,

     

    You can unpivote the Project table columns as below,

    then join Value column with Q_WY column in the dimDate table.

     

     

    Please accept it as a solution if it solves your problem. Thank you.