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
AbdulSaboor987
New Member

Calculate sales till date

Hi All,

 

I want to create a measure that calculates Sales from the start of available data in my table till the last date I have selected.

I am currently using the following formula but the issue is it's affected by the slicer or filter min date selected is there any way to bypass this

 

"

Total Sales Till Max Selected Date =
VAR StartDate = DATE(2022, 7, 1)
VAR MaxSelectedDate = MAX('Date'[Date])
RETURN
CALCULATE(
    SUM(Sales[SLS Qty]),
    FILTER(
        ALL(Sales[Date]),
        Sales[Date]>= StartDate &&
        Sales[Date] <= MaxSelectedDate
    )
)"
4 REPLIES 4
AbdulSaboor987
New Member

Hi thanks for your help but i got the solution using formula below

 

Total Sales Till Max Date =
CALCULATE(
    SUM(Sales[SLS Qty]),
    FILTER(
        ALL(Sales[Date]),
        Sales[Date] <= MAX(Sales[Date])
    ),
    REMOVEFILTERS('Date'[Date])
)
johnyip
Super User
Super User

@AbdulSaboor987 , for an easy solution, you can try to disable the interaction between the slicer and your visual.



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!

Hi,

if i do that i wont be able to select max date

In this case, you may create a calculated table whose column is the exact value of your available date (using DAX), or if you prefer, you can do it in PowerQuery.

 

Leave that calculated table / new PowerQuery Table without any relationship to your data.

 

Then, use that column of your calculated table in your slicer, and change the definition of MaxSelectedDate in your measure.



Please mark my post as the solution if this answers your question!
Appreciate your Kudos !!

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.