Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Relation to get common values from two tables

Hi Community,

 

I am not able to get common values from two tables even after giving a relation.

I have a table1 with Monthly data from 2011 to 2019 and I have another table2 with daily data from 2015 to 2019.

And both the tables having a common column date

Calculated monthly wise totals in both tables.

 

 

Now my requirement is to represent the totals from both tables in a single sheet.

Now I created a relationship with the date and when I add these to into single sheet not giving value as expected.

 

 

 

Any help would be grateful

  • Hi Anonymous ,

     

    Try to combine the two tables into single table Append1 to replace table Sheet1 and Sheet1 using Append Queries , you can also use Append Queries as New, click "Close & Apply" button.

     

     

     

     

     

     

     

     

     

     

     

     

     

    Then you can create measure in the table Append1 using DAX below.

     

    Total Revenue= CALCULATE(SUM(Append1[Revenue]),FILTER(ALLSELECTED(Append1), Append1[Category] =MAX(Append1[Category])&&YEAR(Append1[Date]) =YEAR(MAX(Append1[Date]))&&MONTH(Append1[Date]) =MONTH(MAX(Append1[Date]))))

     

    Best Regards,

    Amy

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

3 Replies

  • v-xicai's avatar
    v-xicai
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Try to combine the two tables into single table Append1 to replace table Sheet1 and Sheet1 using Append Queries , you can also use Append Queries as New, click "Close & Apply" button.

     

     

     

     

     

     

     

     

     

     

     

     

     

    Then you can create measure in the table Append1 using DAX below.

     

    Total Revenue= CALCULATE(SUM(Append1[Revenue]),FILTER(ALLSELECTED(Append1), Append1[Category] =MAX(Append1[Category])&&YEAR(Append1[Date]) =YEAR(MAX(Append1[Date]))&&MONTH(Append1[Date]) =MONTH(MAX(Append1[Date]))))

     

    Best Regards,

    Amy

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

  • v-xicai's avatar
    v-xicai
    Icon for Community Support rankCommunity Support

    Hi  Anonymous ,

     

    Does that make sense? If so, kindly mark my answer as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

     

    Best regards

    Amy