Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
1 year ago
Solved

Variations on December

Hi, I'm new to the Forum and I've been using Power BI for a couple of weeks now. I have a problem that I have already dedicated a few hours and many consultations to Copilot and I cannot solve. ...
  • v-priyankata's avatar
    1 year ago

    Hi Syndicate_Admin 

    Thank you for reaching out to Microsoft Fabric Community.

    To solve the issue of customers disappearing in months where they had no sales (e.g., February), you should use a separate Customer dimension table and a proper Date table, both related to your fact table. This ensures you can maintain customer visibility even when they have no sales in a selected month. Use the Customer table in visuals (not the sales table) and enable "Show items with no data" in the visual settings. To calculate the variation from December of the previous year, regardless of the selected month or whether there were sales, use the following DAX measures:

     

    1. Sales A in December of the Previous Year:

     

    Sales A Dec =
    CALCULATE(
       SUM(Sales[Product A]),
       KEEPFILTERS('Customer'[Customer]),
       FILTER(
           ALL('Date'),
           FORMAT('Date'[Date], "YYYY-MM") = FORMAT(EDATE(MAX('Date'[Date]), -MONTH(MAX('Date'[Date]))), "YYYY-12")
       )
    )

     

    2. Sales Variation from December:

     

     

    Sales A Variation =
    VAR CurrentSales = CALCULATE(SUM(Sales[Product A]))
    VAR DecSales = [Sales A Dec]
    RETURN
       IF(NOT ISBLANK(DecSales), CurrentSales - DecSales)

    These measures ensure that even when a customer has no sales in a filtered month, they are still shown in the report with their December sales and corresponding variation.

    If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
    Thank you.