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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

DAX Help Perfects Stores by Salesman Calculation Help Required

I have a data in Below format : Salesman; Retailer;SKU;Suggested order qty ; Sold Qty.

 

Now i need to Show two things at salesman level

   

Distinct Outlet Suggested ( Which is simple to do and done )

Perfect Outlet covered ( where each Suggested SKU is sold with equal to or Higher qty then Suggested ) Need Help to calculate this.

 

Please help.

 

SalesManRTLSKUSuggested Order QtyQty Sold
S1RTL1SKU12424
S1RTL1SKU22828
S1RTL2SKU1106
S1RTL2SKU3306
S1RTL1SKU42929
S1RTL3SKU22323
S1RTL3SKU11616
S1RTL3SKU32626
S2RTL1SKU11010
S2RTL1SKU21419
S2RTL2SKU13030
S2RTL2SKU32828
S2RTL1SKU31616
S2RTL3SKU2125
S2RTL3SKU12820
S2RTL3SKU32318
1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous,

 

You may try these two Measures.

count of retailers =
VAR res =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[RTL] ),
        ALLEXCEPT ( 'Table', 'Table'[SalesMan] )
    )
RETURN
    SUMX ( VALUES ( 'Table'[SalesMan] ), res )

 

Count of Retilers with Perfect Sales =
VAR NotPerfect =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[RTL] ),
        FILTER ( 'Table', 'Table'[Qty Sold] < 'Table'[Suggested Order Qty] )
    )
VAR PerfectSales = [count of retailers] - NotPerfect
RETURN
    PerfectSales

 

The result should look like this.

vcazhengmsft_0-1655781502040.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

5 REPLIES 5
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous,

 

You may try these two Measures.

count of retailers =
VAR res =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[RTL] ),
        ALLEXCEPT ( 'Table', 'Table'[SalesMan] )
    )
RETURN
    SUMX ( VALUES ( 'Table'[SalesMan] ), res )

 

Count of Retilers with Perfect Sales =
VAR NotPerfect =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[RTL] ),
        FILTER ( 'Table', 'Table'[Qty Sold] < 'Table'[Suggested Order Qty] )
    )
VAR PerfectSales = [count of retailers] - NotPerfect
RETURN
    PerfectSales

 

The result should look like this.

vcazhengmsft_0-1655781502040.png

 

Also, attached the pbix file as reference.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

Anonymous
Not applicable

@v-cazheng-msft  Thanks For the solution !

 

It worked for Me.

 

Only point is thease measures are working fine at Small Data set, but my data is of very large and these measures are taking much time for calculation. is there any way to optimise the calculation by calculating some additional columns or by some other way..

DimaMD
Solution Sage
Solution Sage

Hi, @Anonymous If I understood your task correctly, you need to create a condition for displaying data in the matrix table.  
Red - not done.
Green - overfulfilled
Screenshot_19.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
Anonymous
Not applicable

@DimaMD  Thanks for relplying.

 

Actually that is not required.

 

required below calculation

 

Salesman    count of retailers     Count of Retilers with Perfect Sales

S1            3                                     2

S2            3                                     1

@Anonymous  
The first thing I did was add a column with perfect sales
Screenshot_21.jpg
The second wrote a measure with the calculation of ideal sales where anything greater than or equal to zero is individual sales. I think you were wrong with the desired result
Screenshot_22.jpg



__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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