Forum Discussion

YeltsinC's avatar
YeltsinC
Regular Visitor
5 years ago
Solved

Prepare Target source data for Sankey diagram

Hello,   I am trying to create a Sankey Diagram with the overview of changes over time in each Department over each year (or potentially a smaller period) and am looking for a way to transform the ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi YeltsinC ,

    You can follow the below steps to get it, please find the details in the attachment.

    1. Create a calculated column to get the target SNKID

     

    Target = 
    CALCULATE (
        MIN ( 'Table'[SNKID] ),
        FILTER (
            'Table',
            'Table'[ID] = EARLIER ( 'Table'[ID] )
                && 'Table'[YEAR] > EARLIER ( 'Table'[YEAR] )
        )
    )

     

    2. Create a measure to get the sum of Value

     

    NValue = 
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER ( 'Table', NOT ( ISBLANK ( 'Table'[Target] ) ) )
    )

     

    3. Create a Sankey chart (Source: SNKID   Destination: Target   Weight: NValue)

    Best Regards