Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Creating Invoice Net Amount USD Line in Power BI

Hi, I hope this message finds you well. I am reaching out to seek your expertise and assistance in replicating a specific feature from a Tableau report into Power BI. The challenge I am currently facing is in creating an "Invoice Net Amount USD" line that displays percentages as shown in the Tableau report.

I have attempted to achieve this in Power BI using various approaches, but I haven't been successful in replicating the exact behavior. It appears that the DAX formula I have been using might not be suitable for this specific requirement.

Could you please guide me on the appropriate DAX formula or any other method to achieve a similar percentage display for the "Invoice Net Amount USD" line in Power BI?

I appreciate any insights or suggestions you can provide to help me overcome this hurdle. Thank you in advance for your time and assistance.

 

  • hello Anonymous 

    what you are trying to achieve is a cumulative %. 

     

     

     

    sample data used : 

     

    measure : 

     

    code : 

    Measure 14 =

    var cumlative =
    CALCULATE(
        SUM('Table (15)'[qty]),
        WINDOW(
            0,
            ABS,
            0,
            REL,
            CALCULATETABLE(
            SUMMARIZE(
                'Table (15)',
                'Table (15)'[item]
            ),
            ALLSELECTED( 'Table (15)'[item]))
            ,
            ORDERBY('Table (15)'[item], ASC )
        )
    )

    var total =  CALCULATE(
        SUM('Table (15)'[qty]), ALLSELECTED( 'Table (15)'[item])
        )

        RETURN
        divide(cumlative, total, 0 )
       
     
     
    hope this works.

    Nb:   the orderby in the window function, should be the same as the order of the visual . 

     

    if the x-axis is randomly ordered, i would suggest to create a column to order this column . 
    this can be done as follow : 

    go to table view : 

    select the column in question

    go to sort by column

    choose the index . 

     

     

     

    hope this helps 

     

    best regards.

     

2 Replies

  • Daniel29195's avatar
    Daniel29195
    Icon for Community Champion rankCommunity Champion

    hello Anonymous 

    what you are trying to achieve is a cumulative %. 

     

     

     

    sample data used : 

     

    measure : 

     

    code : 

    Measure 14 =

    var cumlative =
    CALCULATE(
        SUM('Table (15)'[qty]),
        WINDOW(
            0,
            ABS,
            0,
            REL,
            CALCULATETABLE(
            SUMMARIZE(
                'Table (15)',
                'Table (15)'[item]
            ),
            ALLSELECTED( 'Table (15)'[item]))
            ,
            ORDERBY('Table (15)'[item], ASC )
        )
    )

    var total =  CALCULATE(
        SUM('Table (15)'[qty]), ALLSELECTED( 'Table (15)'[item])
        )

        RETURN
        divide(cumlative, total, 0 )
       
     
     
    hope this works.

    Nb:   the orderby in the window function, should be the same as the order of the visual . 

     

    if the x-axis is randomly ordered, i would suggest to create a column to order this column . 
    this can be done as follow : 

    go to table view : 

    select the column in question

    go to sort by column

    choose the index . 

     

     

     

    hope this helps 

     

    best regards.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    but for me it's coming like this