Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
gauthamboppana
Solution Specialist
Solution Specialist

Display products with sales in the latest month in a matrix showing rolling 6-month sales

Hi all,

I have a Matrix Visual showing rolling 6 months sales by Product.  The one requirement is to hide the products that do not have any sales in the latest period. For exmaple, in the below screenshot I have selected Dec 2024. There are no sales for Product E. So product E should not be displayed in the Matrix.

Can any one help? 

I have attached the sample PBIX file.
Linkt-To-Downlaod-Sample-PBIX-File 

gauthamboppana_0-1726478797788.png


This is my DAX formula for calculating the last 6 months sales.

SalesLast6Months =
VAR MaxVisibleDate = MAX('DateTable'[Date])
VAR MinVisibleDate = EDATE(MaxVisibleDate, -5)  -- 6 months
RETURN
CALCULATE(
    SUM(Sales[SalesAmount]),
    FILTER(
        ALL('DateTable'),
        'DateTable'[Date] <= MaxVisibleDate &&
        'DateTable'[Date] >= MinVisibleDate
    )
)


Thank you




1 REPLY 1
Selva-Salimi
Solution Specialist
Solution Specialist

Hi @gauthamboppana 

 you can update your measure as follows:

 

SalesLast6Months =
VAR MaxVisibleDate = MAX('DateTable'[Date])
VAR MinVisibleDate = EDATE(MaxVisibleDate, -5)  -- 6 months
VAR Last_Products = Summarize(filter(sales , sales[date] = maxVisibleDate) , [Products])
RETURN
CALCULATE(
    SUM(Sales[SalesAmount]),
    FILTER(
        ALL('DateTable'),
        'DateTable'[Date] <= MaxVisibleDate &&
        'DateTable'[Date] >= MinVisibleDate
    ) , 
     Filter (Sales , Sales [Product] in Last_products )
)

 

 

If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.