Forum Discussion
Variations on December
- 1 year ago
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.
Syndicate_Admin, please share the sample pbix file, so we can try to help you 🙂
- Syndicate_Admin1 year agoAdministrator
Above you have the link to the table and the comments. Slds and thank you very much in advance.