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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

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
Solution Sage
Solution Sage

@Anonymous , 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 !!
Anonymous
Not applicable

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.