Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Changing visual in crosstab

Hi ALL,

 

I have below vdata coming from query

 

 

Now I want above visual to be changed to like below, I have tried using matrix but it doesnt gives me exact same visual.

 

  • Hi Anonymous

     

     

    Theres is a similar request on this post and if you go to the exceleratorbi link on that message you have the explanation on how to achieve a measure in rows.

     

    I pick up your data and using the solution above work out this final result, see below the step by step and also a download for a pbix sample:

     

    1 - Create a new table:

    Measures Selection

    ID | Measure

    1   | Lines

    2  | Order

     

    2 - Create a measure on the Measures Selection table:

    Selected_Measure = MAX('Measure Selection'[ID])

    3 - Create 4 measures on the Fact_Table (name given to the basic data table):

    Total Order = SUM(Vdata[Total Orders])
    
    Total Line = SUM(Vdata[Total Lines])
    Matrix_values =
    SWITCH (
    [Selected_Measure];
    1 ; [Total Line] ;
    2 ; [Total Order]
    )

    4 - Create a column on Vdata  with the following code

    WeekDay =
    SWITCH (
        WEEKDAY ( Vdata[Delivery_Date] );
        1; "Sun";
        2; "Mon";
        3; "TUE";
        4; "WED";
        5; "THU";
        6; "FRI";
        7; "SAT"
    )

    5 - Add the values to your visual matrix as explained:

    Rows: Measure (column Measure Selection)

    Columns: Delivery Date (column Vdata) + WeekDay (Column VData)

    Values: Matrix_values (measure from VData)

     

    6- Configure you Matrix to have the totals only for delivery date and not for week day

     

     

    Final result:

     

     

    See attach the PBIX file.

     

    Regards,

    MFelix

1 Reply

  • Hi Anonymous

     

     

    Theres is a similar request on this post and if you go to the exceleratorbi link on that message you have the explanation on how to achieve a measure in rows.

     

    I pick up your data and using the solution above work out this final result, see below the step by step and also a download for a pbix sample:

     

    1 - Create a new table:

    Measures Selection

    ID | Measure

    1   | Lines

    2  | Order

     

    2 - Create a measure on the Measures Selection table:

    Selected_Measure = MAX('Measure Selection'[ID])

    3 - Create 4 measures on the Fact_Table (name given to the basic data table):

    Total Order = SUM(Vdata[Total Orders])
    
    Total Line = SUM(Vdata[Total Lines])
    Matrix_values =
    SWITCH (
    [Selected_Measure];
    1 ; [Total Line] ;
    2 ; [Total Order]
    )

    4 - Create a column on Vdata  with the following code

    WeekDay =
    SWITCH (
        WEEKDAY ( Vdata[Delivery_Date] );
        1; "Sun";
        2; "Mon";
        3; "TUE";
        4; "WED";
        5; "THU";
        6; "FRI";
        7; "SAT"
    )

    5 - Add the values to your visual matrix as explained:

    Rows: Measure (column Measure Selection)

    Columns: Delivery Date (column Vdata) + WeekDay (Column VData)

    Values: Matrix_values (measure from VData)

     

    6- Configure you Matrix to have the totals only for delivery date and not for week day

     

     

    Final result:

     

     

    See attach the PBIX file.

     

    Regards,

    MFelix