Forum Discussion

SteffanH's avatar
SteffanH
Frequent Visitor
6 years ago
Solved

How to summarise and transpose (?) data

I have the following (simplified) data

ColumnCurrent ValuePrevious value
CL1TransitioningLeading
CL2LeadingWinding Down
CL3ConsideringPromising
CL5TransitioningPromising
CL4PromisingLaunching

 

I am looking for the best way to create a 'summary' of this data in the following form

 Current valuePrevious Value
Launching01
Considering10
Leading11
Promising12
Transitioning20
Winding Down01

(the numbers are a count of the occurence of each value in 'previous' or 'current')


In order to be able to (ideally) provide the following visualisation (excel mockup)
 

I have the feeling that a Calculated table might be the correct approach, but I have so far been able to find an example that comes close to what I am trying to achieve.

Any pointers in the right direction would be highly appreciated !

  • Hi SteffanH ,

     

    Believe there is no need to create a new sumarization table. Try the following steps:

     

    • Add a new table with the status (without any relationship to the other table)
    • Create the following two measure:
    Current = CALCULATE(COUNT('Values'[Column]);FILTER('Values';'Values'[Current Value]= SELECTEDVALUE('Status'[Status]))) + 0
    
    Previous = CALCULATE(COUNT('Values'[Column]);FILTER('Values';'Values'[Previous value]= SELECTEDVALUE('Status'[Status]))) + 0

     

    • Then  use this on your two visualizations

    Other option to go is:

    • Unpivot the Current Value and Previous value columns
    • Create a status table with relationship active to the first table
    • Create this two measures:
    CurrentUnpivot = CALCULATE(COUNT('Values (Unpivot)'[Column]);'Values (Unpivot)'[Type] = "Current value") + 0
    
    PreviousUnpivot = CALCULATE(COUNT('Values (Unpivot)'[Column]);'Values (Unpivot)'[Type] = "Previous value") + 0
    • Create your visualizations normally.

    Check PBIX file attach.

     

5 Replies

  • Hi SteffanH ,

     

    Believe there is no need to create a new sumarization table. Try the following steps:

     

    • Add a new table with the status (without any relationship to the other table)
    • Create the following two measure:
    Current = CALCULATE(COUNT('Values'[Column]);FILTER('Values';'Values'[Current Value]= SELECTEDVALUE('Status'[Status]))) + 0
    
    Previous = CALCULATE(COUNT('Values'[Column]);FILTER('Values';'Values'[Previous value]= SELECTEDVALUE('Status'[Status]))) + 0

     

    • Then  use this on your two visualizations

    Other option to go is:

    • Unpivot the Current Value and Previous value columns
    • Create a status table with relationship active to the first table
    • Create this two measures:
    CurrentUnpivot = CALCULATE(COUNT('Values (Unpivot)'[Column]);'Values (Unpivot)'[Type] = "Current value") + 0
    
    PreviousUnpivot = CALCULATE(COUNT('Values (Unpivot)'[Column]);'Values (Unpivot)'[Type] = "Previous value") + 0
    • Create your visualizations normally.

    Check PBIX file attach.

     

    • SteffanH's avatar
      SteffanH
      Frequent Visitor

      Hi Miguel,

       

      Thank you for your response !

       

      I am unable to open the attached pbix file with PBI v2.76 (December 2019) and get a syntax error on your suggested measure after 

      CALCULATE(COUNT('Values'[Column]);

      For anyone else trying to reproduce: I managed to resolve this by changing the ";" after COUNT to a "," and the same applies for the ";" after FILTER

      This is exactly what I needed 👍

      But I have a follow-up question:
      When I click on any of the summarised values, a table I added to the same report page does not get filtered, by the selected Status is that because no link exists between the newly created "Status" helper table ? 

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

        Hi SteffanH 

         

        Regarding the question about the dot comma and comma is regional settings related, depending on the settings of your computer the function parameters are determined by dot comma or comma. 😀

         

        If you went to the first option that is a non-related table that is correct, since you don't have a relationship you will not get filtering information.