Forum Discussion
Display Data with Montn
Hello,
I have a set of data with Actual Values in one column and Target Values in second column, for every month.
I cannot figure out how to display those 2 values for each corresponding month side by side showing zero value as well.
For example: Value1 and Value2 for each month should be in one row but past month value from value1 (table1), current month value is greater between value1 and value2 and future month value from value2(table2)
Thank you for your help
| Table1 | ||
| ID | Date | Value1 |
| A100 | 1/1/2020 | 100 |
| A100 | 2/1/2020 | |
| A100 | 3/1/2020 | 200 |
| A100 | 4/1/2020 | |
| A100 | 5/1/2020 | |
| A100 | 6/1/2020 | 300 |
| A100 | 7/1/2020 | 100 |
| A100 | 8/1/2020 | |
| A100 | 9/1/2020 | |
| A100 | 10/1/2020 | |
| A100 | 11/1/2020 | |
| A100 | 12/1/2020 | |
| A1110 | 1/1/2020 | 400 |
| A1110 | 2/1/2020 | 200 |
| A1110 | 3/1/2020 | 200 |
| A1110 | 4/1/2020 | |
| A1110 | 5/1/2020 | |
| A1110 | 6/1/2020 | 300 |
| A1110 | 7/1/2020 | 300 |
| A1110 | 8/1/2020 | |
| A1110 | 9/1/2020 | |
| A1110 | 10/1/2020 | |
| A1110 | 11/1/2020 | |
| A1110 | 12/1/2020 |
| Table2 | ||
| ID | Date | Value2 |
| A100 | 1/1/2020 | |
| A100 | 2/1/2020 | |
| A100 | 3/1/2020 | 200 |
| A100 | 4/1/2020 | |
| A100 | 5/1/2020 | 300 |
| A100 | 6/1/2020 | |
| A100 | 7/1/2020 | 200 |
| A100 | 8/1/2020 | |
| A100 | 9/1/2020 | 100 |
| A100 | 10/1/2020 | 1000 |
| A100 | 11/1/2020 | |
| A100 | 12/1/2020 | 200 |
| A1110 | 1/1/2020 | 400 |
| A1110 | 2/1/2020 | 200 |
| A1110 | 3/1/2020 | 200 |
| A1110 | 4/1/2020 | |
| A1110 | 5/1/2020 | |
| A1110 | 6/1/2020 | 300 |
| A1110 | 7/1/2020 | 350 |
| A1110 | 8/1/2020 | 500 |
| A1110 | 9/1/2020 | 600 |
| A1110 | 10/1/2020 | 400 |
| A1110 | 11/1/2020 | 500 |
| A1110 | 12/1/2020 | 500 |
Hi topazz11 ,
Pls test the below dax to create a new column on the table1:
test = VAR test1 = IF ( LOOKUPVALUE ( Table2[Value2], Table2[Date], Table1[Date], Table2[ID], Table1[ID] ) = BLANK (), 0, LOOKUPVALUE ( Table2[Value2], Table2[Date], Table1[Date], Table2[ID], Table1[ID] ) ) VAR test2 = IF ( Table1[Value1] = BLANK (), 0, Table1[Value1] ) RETURN IF ( test1 > test2, test1, test2 )Did I answer your question? Mark my post as a solution!
Best RegardsLucien
1 Reply
- v-luwang-msft
Community Support
Hi topazz11 ,
Pls test the below dax to create a new column on the table1:
test = VAR test1 = IF ( LOOKUPVALUE ( Table2[Value2], Table2[Date], Table1[Date], Table2[ID], Table1[ID] ) = BLANK (), 0, LOOKUPVALUE ( Table2[Value2], Table2[Date], Table1[Date], Table2[ID], Table1[ID] ) ) VAR test2 = IF ( Table1[Value1] = BLANK (), 0, Table1[Value1] ) RETURN IF ( test1 > test2, test1, test2 )Did I answer your question? Mark my post as a solution!
Best RegardsLucien