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
JimSales81
Frequent Visitor

Dynamic Measure showing Percent of Location and Region

Hello,


I want to calculate a dynamic measure that shows an idividual's sales as a % of her Store's Sales and a separate measure that shows her Sales as a % of her Region's sales. 

 

Total Sales=Sum('FACT Sales'[Amount])

 

Everytime i try to use ALL or AllExcept on the Store # or Region, i get 100% instead of the desired %.

 

Thanks!

 

 

 

Power BI Example.JPG

Thanks!

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @JimSales81 

 

You can try the following methods.
Measure:

Store Sales = 
VAR _N1 =
    CALCULATE ([Total Sales],
        FILTER ( ALL ( 'FACT Sales' ),
            RELATED ( 'DIM Sales Person'[Store] ) = MAX ( 'DIM Store'[Store#] ) ) )
RETURN
    IF ( NOT ( ISBLANK ( [Total Sales] ) ), _N1 )
Region Sales = 
VAR _N1 =
    CALCULATE ([Total Sales],
        FILTER ( ALL ( 'FACT Sales' ),
            RELATED ( 'DIM Store'[Region] ) = MAX ( 'DIM Store'[Region] ) ) )
RETURN
    IF ( NOT ( ISBLANK ( [Total Sales] ) ), _N1 )
% of Store Sales = DIVIDE([Total Sales],[Store Sales])
% of Region Sales = DIVIDE([Total Sales],[Region Sales])

vzhangti_0-1679032702353.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @JimSales81 

 

You can try the following methods.
Measure:

Store Sales = 
VAR _N1 =
    CALCULATE ([Total Sales],
        FILTER ( ALL ( 'FACT Sales' ),
            RELATED ( 'DIM Sales Person'[Store] ) = MAX ( 'DIM Store'[Store#] ) ) )
RETURN
    IF ( NOT ( ISBLANK ( [Total Sales] ) ), _N1 )
Region Sales = 
VAR _N1 =
    CALCULATE ([Total Sales],
        FILTER ( ALL ( 'FACT Sales' ),
            RELATED ( 'DIM Store'[Region] ) = MAX ( 'DIM Store'[Region] ) ) )
RETURN
    IF ( NOT ( ISBLANK ( [Total Sales] ) ), _N1 )
% of Store Sales = DIVIDE([Total Sales],[Store Sales])
% of Region Sales = DIVIDE([Total Sales],[Region Sales])

vzhangti_0-1679032702353.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@JimSales81 , try like

 

% Sales=divide(Sum('FACT Sales'[Amount]), calculate(Sum('FACT Sales'[Amount]), allexcept(Sales, 'Dim Region'[Region]) ) )

 

% Sales=divide(Sum('FACT Sales'[Amount]), calculate(Sum('FACT Sales'[Amount]), allexcept(Sales, 'Dim Region'[Region]) ) )

 

% Sales=divide(Sum('FACT Sales'[Amount]), calculate(Sum('FACT Sales'[Amount]), allexcept(Sales, 'Dim Store'[Store]) ) )

Amit,


Thank you but both are still coming up with 100% for everyone.  how does the filter context know which region/store to tie to any individual in your measures? 

 

THanks,
Jim

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.