Forum Discussion

fksng66's avatar
fksng66
Icon for Helper II rankHelper II
2 years ago
Solved

Combine two charts into one

Hi there, 

I would like to combine these two charts (organic + paid ads) into one bar chart

 

I tried to create a measure with the fomula 

Total Impressions (organic+paid ads) = SUM(Facebook[Impressions]) + SUM(PaidAd_FB[Impressions])
 
but this is the result i got instead, did I missed out something here?

 


 

 
  • Hi,

    Create a Calendar Table with calculated column formulas of Year, Month name and Month number.  Sort the Month name column by the Month number column.  Create a relationship (Many to One and single) from the Date column of both Fact Tables to the Date column of the Calendar Table.  To the Xaxis, drag Year and Month name from t he Calendar Table.

    Hope this helps.

  • hello fksng66 

     

    have you set a relationship (month column) between those two tables?

     

    I made a simple example below with exact same DAX as you used :

    - without relationship - the result is sum-ed to all month

    - with relationship (month column) - the result is depend on month relationship

     

    Hope this will help.

    Thank you.

  • fksng66 Okay, So basically you can use a date table and connect it to both the tables from where the data is coming, and use the x-axis columns from the date table, then your data will get filter according to your requirement.

    To create a date table you can use below dax:

    DateTable =
    ADDCOLUMNS(
    CALENDAR(DATE(2020, 1, 1), DATE(2030, 12, 31)),
    "Year", YEAR([Date]),
    "Month", MONTH([Date]),
    "Day", DAY([Date])
    )

    Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

7 Replies

  • Hi,

    Create a Calendar Table with calculated column formulas of Year, Month name and Month number.  Sort the Month name column by the Month number column.  Create a relationship (Many to One and single) from the Date column of both Fact Tables to the Date column of the Calendar Table.  To the Xaxis, drag Year and Month name from t he Calendar Table.

    Hope this helps.

    • fksng66's avatar
      fksng66
      Icon for Helper II rankHelper II

      anmolmalviya05 supposedly i should get 90402 for jan's month data after combining both the organic and paid ads

      • anmolmalviya05's avatar
        anmolmalviya05
        Icon for Super User rankSuper User

        fksng66 Okay, So basically you can use a date table and connect it to both the tables from where the data is coming, and use the x-axis columns from the date table, then your data will get filter according to your requirement.

        To create a date table you can use below dax:

        DateTable =
        ADDCOLUMNS(
        CALENDAR(DATE(2020, 1, 1), DATE(2030, 12, 31)),
        "Year", YEAR([Date]),
        "Month", MONTH([Date]),
        "Day", DAY([Date])
        )

        Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

  • hello fksng66 

     

    have you set a relationship (month column) between those two tables?

     

    I made a simple example below with exact same DAX as you used :

    - without relationship - the result is sum-ed to all month

    - with relationship (month column) - the result is depend on month relationship

     

    Hope this will help.

    Thank you.