Forum Discussion

Alfista1997's avatar
Alfista1997
Frequent Visitor
3 years ago

DAX Calculated Column Sum with Two Categories

I'm trying to create a column in table 1, that refrences table 2 and sum the values in Column 1 for each ID and Year-Month and divide that by the sum of values in Column 2 for each ID and Year-Month and have that result populate into my other table. 

 

If I've got 2 IDs 17964 and 54008 with a table like this, but there's a lot more columns of course. Then Table 2 looks like below, there is no data for 17964, so techically it should return blank/0. The new column in table one should return 0 and 0 for 17964, and 282% and 266% for 54008 for each of their respective yr-month and id.

 

Table 1

IDYear-Month
17964202306
17964202305
54008202306
54008202305

 

Table 2

  Yr-M        ID        Colm. 1     Colm. 2       Ignore/DateField

2023055400831007.455513.61Monday, May 1, 2023
2023055400816819.557053.2Monday, May 1, 2023
2023055400804375.85Monday, May 1, 2023
2023065400831007.455719.69Thursday, June 1, 2023
2023065400816819.557135.67Thursday, June 1, 2023
2023065400805115.12Thursday, June 1, 2023