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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
RD_PowerBI24
Helper I
Helper I

MTD Flatline after latest daily sales. How to hide/remove?

Hi,

 

I currently have a visual for MTD sales, where after the latest daily sales, the rest of the day for the month flatlines, with no new sales. How can I stop this so that the MTD sales stops as the latest day.

 

RD_PowerBI24_0-1713823840599.png

 

I have used the following with no success:

 

MTD_Sales = if(ISBLANK(TOTALMTD(SUM(All_Sales[Total_Sales]), All_Sales[All_Invoice_Date].[Date])),BLANK(),CALCULATE(

    TOTALMTD(SUM(All_Sales[Total_Sales]),All_Sales[All_Invoice_Date].[Date],FILTER(

        ALLSELECTED(All_Sales[Invoice Date].[Date]),

        ISONORAFTER(All_Sales[Invoice Date].[Date], MAX(All_Sales[Invoice Date].[Date]), DESC)

    ))))

MTD_Sales = TOTALMTD(SUM(All_Sales[Total_Sales]),All_Sales[All_Invoice_Date].[Date])

 

N.B.  All_Sales[All_Invoice_Date] is aligned to the dates for the budgets  and sales

 

RD_PowerBI24_2-1713824049132.png

 

1 ACCEPTED SOLUTION

I solved this by using a calculated column on the sales fact dates, which gave a true/false value. Then filtered the table on this column to hide the false. DatesWithSales = 'Date'[Date] <= MAX ( Sales[Order Date] )

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

Instead of ISONORAFTER(DESC) use DATESBETWEEN the MIN and MAX fact dates for each period.

I solved this by using a calculated column on the sales fact dates, which gave a true/false value. Then filtered the table on this column to hide the false. DatesWithSales = 'Date'[Date] <= MAX ( Sales[Order Date] )

Hi, I tried this by amending it to:

 

MTD_Sales = if(ISBLANK(TOTALMTD(SUM(All_Sales[Total_Sales]), All_Sales[All_Invoice_Date].[Date])),BLANK(),CALCULATE(

    TOTALMTD(SUM(All_Sales[Total_Sales]),All_Sales[All_Invoice_Date].[Date],FILTER(

        ALLSELECTED(All_Sales[Invoice Date].[Date]),

        DATESBETWEEN(All_Sales[Invoice Date].[Date],MIN(All_Sales[Invoice Date].[Date]),MAX(All_Sales[Invoice Date].[Date])

    )))))

 

But the visual breaks and I get this error:

RD_PowerBI24_0-1713853083504.png

FYI: All_Invoice_Date is for all dates taken from Budget or Sales tables, whereas Invoice Date is for sales, which is what I want to restrict the sum on here.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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