Forum Discussion

SteelChampzz's avatar
SteelChampzz
Icon for Helper II rankHelper II
3 years ago
Solved

Creating DAX measure from excel worksheet

 
I have 3 tables:

*Fruit-Ordered*

*Fruit-Sold*

*Fruit+Ordered*

 

 

I've brought this data in from Excel but I need to be able to create a measure in Power BI to create "Percentage" for the Total & also the "percentage" for the Products as well.

 

"Percentage Total"

 


 

 

"Percentage OF TOTAL"

 


 

I've already have a measure for the total of "Sold+Ordered" but having the issues with using "VAR" or "FILTERS" to create the measures for "PERCENTAGE OF THE TOTAL"

 

Any HELP would be awesome, I didn't explain this correctly the first time so hopefully I can get some answer.

Thank everyone

 

 

 

  • Hi SteelChampzz,

     

    You can use the following DAX formulas:

     

    % = 'Table'[Amount]/SUM('Table'[Amount])

     

    Index = RANKX('Table','Table'[Product],,ASC)

     

    Total = SUMX('Table', IF('Table'[Index]<=EARLIER('Table'[Index]),'Table'[%],0))

     

    Result:

     

     

    Works for you? Mark this post as a solution if it does!

2 Replies

  • Shaurya's avatar
    Shaurya
    Icon for Memorable Member rankMemorable Member

    Hi SteelChampzz,

     

    You can use the following DAX formulas:

     

    % = 'Table'[Amount]/SUM('Table'[Amount])

     

    Index = RANKX('Table','Table'[Product],,ASC)

     

    Total = SUMX('Table', IF('Table'[Index]<=EARLIER('Table'[Index]),'Table'[%],0))

     

    Result:

     

     

    Works for you? Mark this post as a solution if it does!

    • SteelChampzz's avatar
      SteelChampzz
      Icon for Helper II rankHelper II

      This defintely helped! Thank you, now my next question is this:

      I have 2 tables that I've created these "new columns" in.

      Table 1=Order

      Table 2=Sold

      I want to put "order+Sold" together to create the "Cumulative Total Percentage" for each Product.

      How would I write that measure?