Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
depple
Helper III
Helper III

Measure - Market share of grand total

Hi,

 

First of all, I am quite a newbie with creating Dax measures, so please bear over with my shortcomings of knowledge (and probably also ability to explain the actual issue).

 

Primarily, I am trying to visualize (line chart) the development of market share of a selected group of products, the base being sales of all products

 

Mockup of all data (no column for :

table1

ProductTypeData levelSizeSalesShare of Grand Total Sales
AlfaAGeographyS100,10
BravoBGeographyM150,15
CharlieBChainL250,25
DeltaCChainM400,40
EchoBChainM100,10
Grand Total   1001

 

So the key is: After slicer operations, the Sales of each product is to be measured against the "all" salesa in the table.

 

Desired result of measure (* mark slicer selections)

ProductType*Data level*SizeSalesShare of Grand Total Sales
CharlieBChainL250,25
EchoBChainM100,1
Total    0,35

 

My secondary challenge, due to the data structure, I need the Dax measure to control which of the slicers that should influence the base (and others not). Is this possible?

 

I would really appreciate any input.

 

Regards,

depple

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@depple 

You can create the following measure to get the desired results:

Share of Grand Total Sales = 
DIVIDE(
    SUM(SalesData[Sales]),
    CALCULATE(
            SUM(SalesData[Sales]),
            ALL(SalesData)
    )
)


If you need to control the clearing of filters then you can selectively choose with ALLEXCEPT as follows:

Share of Grand Total Sales = 
DIVIDE(
    SUM(SalesData[Sales]),
    CALCULATE(
            SUM(SalesData[Sales]),
            ALLEXCEPT(SalesData, SalesData[Type])
    )
)






Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@depple 

You can create the following measure to get the desired results:

Share of Grand Total Sales = 
DIVIDE(
    SUM(SalesData[Sales]),
    CALCULATE(
            SUM(SalesData[Sales]),
            ALL(SalesData)
    )
)


If you need to control the clearing of filters then you can selectively choose with ALLEXCEPT as follows:

Share of Grand Total Sales = 
DIVIDE(
    SUM(SalesData[Sales]),
    CALCULATE(
            SUM(SalesData[Sales]),
            ALLEXCEPT(SalesData, SalesData[Type])
    )
)






Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy 

 

That worked perfectly!

 

Ended up with quite a lot of ALLEXCEPT-columns, maybe there should be a ALLSELECTEDEXCEPT function 🙂

 

Thank you very much for your help, that really pushed my report forward.

 

/depple

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors