Forum Discussion

NewbieJono's avatar
NewbieJono
Icon for Post Partisan rankPost Partisan
3 years ago
Solved

Sync Y Axis

hello all, any ideas what DAXi could use to sync the two y Axis on the following charts. the data comes from two different tables.   i guess I want to find the max value of the max month from bot...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  NewbieJono ,

     

    Here are the steps you can follow:

    1. Create calculated table.

    Table =
    var _table1=
    SUMMARIZE(
    'Table1',Table1[Date],"Value",SUMX(FILTER(ALL(Table1),YEAR('Table1'[Date])=YEAR(EARLIER('Table1'[Date]))&&MONTH('Table1'[Date])=MONTH(EARLIER('Table1'[Date]))),[Value1]),"Table","Table1")
        var _table2=
    SUMMARIZE(
    'Table2',Table2[Date],"Value",SUMX(FILTER(ALL(Table2),YEAR('Table2'[Date])=YEAR(EARLIER('Table2'[Date]))&&MONTH('Table2'[Date])=MONTH(EARLIER('Table2'[Date]))),[Value2]),"Table","Table2")
    var _table3=
    UNION(_table1,_table2)
    var _table4=
    FILTER(
        _table3,
       [Value]=MAXX(FILTER(_table3,[Table]=EARLIER([Table])&&YEAR([Date])=YEAR(EARLIER([Date]))),[Value]))
    return
    _table4

    2. Create measure.

    Flag =
    var _column1=SELECTCOLUMNS(FILTER('Table','Table'[Table]="Table1"),"1",[Date])
    var _column2=SELECTCOLUMNS(FILTER('Table','Table'[Table]="Table2"),"2",[Date])
    return
        IF(
        NOT(MAX('Table2'[Date])) in _column2,1,
        IF(
        NOT(MAX('Table1'[Date])) in _column1 ,0,1)
    )

    3. Set [Flag] to is=1 in Table 1 and set [Flag] to is=0 in Table2.

     

    4. Result:

     

    Best Regards,

    Liu Yang

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