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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JaouadZrhibi
Helper I
Helper I

Market share issue - Distribution over a single year

Hi,

 

I have tried different measures but I cant see the distribution over a single year.

 

My formula calculate the market share for all years from 2001 till 2018 but how to do it for only one year ?

 

one year for one direction (import or export) = 100% market share 

 


Market share issue_Distribution over 1 year.jpg

 

 

Market Share Import = DIVIDE(CALCULATE(SUM([Tons]));CALCULATE(SUM([Tons]);ALL('Details'); Table[Column] = "Import")) 

Market Share Export = DIVIDE(CALCULATE(SUM([Tons]));CALCULATE(SUM([Tons]);ALL('Details'); Table[Column] = "Export")) 

 

OR 

 

Market Share = DIVIDE ( CALCULATE ( SUM ( [Tons] ) ), CALCULATE ( SUM ( [Tons] ), VALUES ( Details[Direction] ), ALL ( Details ) ) )

 

 

PBIX file =  https://drive.google.com/open?id=1sRFKhMPu1LSjMtk58_Z7e_B1BTHhn5FS

 

Thank you for your help and support,

 

Jaouad

10 REPLIES 10
v-frfei-msft
Community Support
Community Support

Hi @JaouadZrhibi,

 

Please update the measure Market Share to this one.

 

 

Market Share = DIVIDE(CALCULATE(SUM([Tons])),CALCULATE(SUM([Tons]),ALLEXCEPT('Details',Period[Year]))) 

Capture.PNG

 

Also please find the pbix attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi Frank @v-frfei-msft  Hi Greg @Greg_Deckler

 

I thank you for your measure but I need to separate Import & Export markets.

 

I would like to get 100% market share if we select only IMPORT.

 

Also 100% market share if we select only EXPORT.

 

In fact, it isn't pertinent to "mix" import & export markets because they are different markets.

 

File is here

https://drive.google.com/open?id=1sRFKhMPu1LSjMtk58_Z7e_B1BTHhn5FS

 

Please see the pictures below. Hope they will help you.

 

One year and Import selected.png

 

One year and EXPORT selected.jpg

 

 

Thank you for your help !

 

Jaouad

 

 

 


@v-frfei-msft wrote:

Hi @JaouadZrhibi,

 

Please update the measure Market Share to this one.

 

 

Market Share = DIVIDE(CALCULATE(SUM([Tons])),CALCULATE(SUM([Tons]),ALLEXCEPT('Details',Period[Year]))) 

Capture.PNG

 

Also please find the pbix attached.

 

Regards,

Frank




Hi @JaouadZrhibi,

 

Please check the formula again.

 

Market Share = 
var maxyear = MAX(Period[Year])
var Direction = SELECTEDVALUE(Details[Direction])
return 
DIVIDE(CALCULATE(SUM([Tons])),CALCULATE(SUM([Tons]),FILTER(ALL(Details),Details[Year]=maxyear && Details[Direction]=Direction)))

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @v-frfei-msft

 

It looks good, I m going to do some test.

 

If we want to see the market share on 2 years / 3 years or 10 years, can we get 100% for each one ?

 

For example, 2 years = 2016 and 2017 = 100% market share

 

3 years = 2013 + 2014 + 2015 = 100% market share

 

10 years = from 2009 till 2017 = 100% market share

 

Do we have to change all formula ? If it is too difficult, it is not necessary. 

 

One year is really good.

 

I m sorry for disturbing you Frank.

 

Thank you very much for your help and time !!

 

Jaouad

 

 

 

 

 


@v-frfei-msft wrote:

Hi @JaouadZrhibi,

 

Please check the formula again.

 

Market Share = 
var maxyear = MAX(Period[Year])
var Direction = SELECTEDVALUE(Details[Direction])
return 
DIVIDE(CALCULATE(SUM([Tons])),CALCULATE(SUM([Tons]),FILTER(ALL(Details),Details[Year]=maxyear && Details[Direction]=Direction)))

 

Regards,

Frank


 

Hi @JaouadZrhibi,

 

Here we go.

 

Market Share2 = 
var minyear = MIN(Period[Year]) 
var maxyear = MAX(Period[Year])
var Direction = SELECTEDVALUE(Details[Direction])
return 
DIVIDE(CALCULATE(SUM([Tons])),CALCULATE(SUM([Tons]),FILTER(ALL(Details),Details[Year]<=maxyear&&Details[Year]>=minyear && Details[Direction]=Direction)))

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @v-frfei-msft

 

I would like to know if this formula below is good for the Market Share measure :

 

Market Share =
DIVIDE (
    CALCULATE ( SUM ( [Tons] ) );
    CALCULATE (
        SUM ( [Tons] );
        FILTER (
            ALL ( 'Details' );
            YEAR ( Details[Date] ) IN VALUES ( Period[Year] )
                && Details[Direction] IN VALUES ( Details[Direction] )
        )
    )
)

 

Hi @JaouadZrhibi,

 

Just use the new measure in the visual, now shuold be ok. Please find the pbix attached. Also your formula worked well. You can refer to the third page.

 

2.PNG

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

We need only one Market Share Measure for all widget on the same page, isn't it ?

We neen only one Market Share Measure for all widget on the same page, isn't it ?

I find figures above 100 % like on the pictures.

 

Is it normal ?

 

figures above 100%.jpg

 

Regards,

 

Jaouad

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.