Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Displaying size range for items with no data

Hi, I am trying to find the best way to present data of product availability as follows: 1. We have a table of available stock in different sizes but not always all sizes are available (in which ca...
  • johnbasha33's avatar
    2 years ago

    Anonymous 

    To achieve the desired result in Power BI, you can follow these steps:

    1. Load both tables (available stock and size grid lookup) into Power BI.
    2. Create a relationship between the two tables based on the "Product" column.
    3. Create a new calculated column in the size grid lookup table to concatenate the "Product" and "Size" columns. This will be used for lookup purposes.
    4. Create a new calculated column in the available stock table to calculate the total quantity for each product and size combination. Use a DAX formula like this:

    ```dax
    TotalQty = CALCULATE(SUM('Available Stock'[Qty]), ALLEXCEPT('Available Stock', 'Available Stock'[Product], 'Available Stock'[Size]))
    ```

    5. Use a matrix or table visual in Power BI to display the data. Use the "Product" column from the size grid lookup table as rows and the "Size" column from the size grid lookup table as columns.
    6. Use the "TotalQty" calculated column as the values in the matrix or table visual.
    7. Format the visual to display 0 instead of blank for missing values. You can do this by going to the "Format" pane, expanding the "Values" section, and selecting "Show items with no data" and choosing "Show items with no data as 0".

    This approach will dynamically display the available stock quantities for each product and size combination, without the need for dummy rows for missing sizes. You can customize the visual further to highlight cells or apply conditional formatting as needed.

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