Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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
  • 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.

     

    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

5 Replies

  • DimaMD's avatar
    DimaMD
    Icon for Solution Sage rankSolution 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

    • Anonymous's avatar
      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

      • DimaMD's avatar
        DimaMD
        Icon for Solution Sage rankSolution Sage

        Anonymous  
        The first thing I did was add a column with perfect sales

        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



  • v-cazheng-msft's avatar
    v-cazheng-msft
    Icon for Community Support rankCommunity 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.

     

    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's avatar
      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..