Forum Discussion

tbdbitl08's avatar
tbdbitl08
Regular Visitor
1 year ago
Solved

Create Gap Analysis Table From Two Tables - Raw Data and Ideal State

Hello - I am looking to create a comparative analysis for a sales team. They have provided two data sets in CSV format - the first dataset is a list of all clients where each row contains the client name (org), a product sold (product), and the product category (category). The second sata set is their "ideal state" of products they think all clients should have. The goal is to create a new table that shows what products are missing, by each client, from the ideal state so they know what to try to sell to them. I have included some sample datasets below and what I am trying to show in the expected output. I am unsure if there is a way to do this, or visualize it etc. At the end of the day, we want to be able to show what a customer is missing, easily, so the team can know what the client needs, like in the Example Output, without having to manually create a new table. 

 

 

11 Replies

  • Hi tbdbitl08 ,
    Please try using:-

    MissingProducts =
    VAR AllClients = DISTINCT('Example Client Table'[Org])
    VAR AllProducts = 'Example Ideal State Table'
    RETURN
    ADDCOLUMNS(
    FILTER(
    CROSSJOIN(AllClients, AllProducts),
    NOT (
    'Example Client Table'[Org] = [Org] &&
    'Example Client Table'[Product] = [Product]
    )
    ),
    "Org", [Org],
    "Product", [Product],
    "Category", [Category]
    )

    ๐ŸŒŸ I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.

    ๐Ÿ’ก Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.

    ๐ŸŽ– As a proud SuperUser and Microsoft Partner, weโ€™re here to empower your data journey and the Power BI Community at large.

    ๐Ÿ”— Curious to explore more? [Discover here].

    Letโ€™s keep building smarter solutions together!

     

    • tbdbitl08's avatar
      tbdbitl08
      Regular Visitor

      Hi there! When I go to create a new table and add this in, and change the appropriate file/table names I get the equivalent of an error "The ambiguous column reference [organization] can't be resolved." and am a bit unsure as to my next steps. Is there a need to create any relationships, or is there something else I may be missing? Thank you!

    • tbdbitl08's avatar
      tbdbitl08
      Regular Visitor

      Just giving this a little judge to see if yourself, or anyone else, has any other suggestions. Thank you!

      • v-menakakota's avatar
        v-menakakota
        Icon for Community Support rankCommunity Support

        Hi tbdbitl08 ,
        Thank you for reaching out to us on the Microsoft Fabric Community Forum.

        We really apologies for the inconvenience, after reviewing the issue by using the concept of merging followed the below steps  and got the result like below which i have shared the pbix file,please go through the file:

        • Grouped the data by Client Name to isolate available products for each client.

        • Separated the grouped data into individual tables for comparison against an ideal product list.

        • Performed a Right Anti Join between each client-specific table and the ideal product table to identify missing products. (The Ideal table was used as the right table in the join.)

        • Repeated the process for each client to ensure full coverage.

        • Appended the results from all clients into a consolidated table and cleaned up by removing any unnecessary columns.

           

        If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.