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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Lily36876
Helper II
Helper II

A cross table complex condition

Hi Experts!

 

I have two tables, one containing the monthly incentive amount for each store counter, and the other containing the sales personnel for each store counter and whether they have reached the monthly target. I want to calculate the incentive amount for each store counter to be evenly distributed only among the sales personnel who have reached their monthly targets.

 

Lily36876_0-1711416587543.png

 

1 ACCEPTED SOLUTION

Hi @Lily36876 

The solution @ryan_mayu  provided is excellent, I want to offer some more information for you to refer to, the sample data is the same as you provided.

You can create the following measure.

MEASURE =
VAR a =
    CALCULATE (
        MAX ( 'Monthly incentive amount'[Incentive] ),
        'Monthly incentive amount'[ShopNo]
            = MAX ( 'Sales personnel store counter'[ShopNo] ),
        'Monthly incentive amount'[YearMonth]
            = MAX ( 'Sales personnel store counter'[YearMonth] )
    )
VAR b =
    CALCULATE (
        COUNTROWS ( 'Sales personnel store counter' ),
        ALLSELECTED ( 'Sales personnel store counter' ),
        'Sales personnel store counter'[ShopNo]
            IN VALUES ( 'Sales personnel store counter'[ShopNo] ),
        'Sales personnel store counter'[YearMonth]
            IN VALUES ( 'Sales personnel store counter'[YearMonth] ),
        'Sales personnel store counter'[Achieve] = "YES"
    )
RETURN
    IF (
        MAX ( 'Sales personnel store counter'[Achieve] ) <> BLANK (),
        DIVIDE ( a, b )
    )

Output

vxinruzhumsft_0-1711677664081.png

Best Regards!

Yolo Zhu

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

9 REPLIES 9
ryan_mayu
Super User
Super User

how to calculate the incentive column?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Identify sales in the store who have achieved the performance targets, and then evenly distribute the incentive.

why there is no value for 078?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




078 didn't reach the target in 2024/01 ,so can't got the incentive~

 

Thanks

you can do this in PQ

11.PNG

 

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Yes It's what I want!!!

But the pivot table I provide is after summerize in Dax

Hi @Lily36876 

The solution @ryan_mayu  provided is excellent, I want to offer some more information for you to refer to, the sample data is the same as you provided.

You can create the following measure.

MEASURE =
VAR a =
    CALCULATE (
        MAX ( 'Monthly incentive amount'[Incentive] ),
        'Monthly incentive amount'[ShopNo]
            = MAX ( 'Sales personnel store counter'[ShopNo] ),
        'Monthly incentive amount'[YearMonth]
            = MAX ( 'Sales personnel store counter'[YearMonth] )
    )
VAR b =
    CALCULATE (
        COUNTROWS ( 'Sales personnel store counter' ),
        ALLSELECTED ( 'Sales personnel store counter' ),
        'Sales personnel store counter'[ShopNo]
            IN VALUES ( 'Sales personnel store counter'[ShopNo] ),
        'Sales personnel store counter'[YearMonth]
            IN VALUES ( 'Sales personnel store counter'[YearMonth] ),
        'Sales personnel store counter'[Achieve] = "YES"
    )
RETURN
    IF (
        MAX ( 'Sales personnel store counter'[Achieve] ) <> BLANK (),
        DIVIDE ( a, b )
    )

Output

vxinruzhumsft_0-1711677664081.png

Best Regards!

Yolo Zhu

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

 

 

Thanks for your amazing and useful and right solution!!!!

you can group by data in PQ.

https://learn.microsoft.com/en-us/power-query/group-by?wt.mc_id=DP-MVP-5004616

 

or pls provide the raw data





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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