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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Bwendos_Den
Frequent Visitor

How to calculate Total Sales showing only until the month before current month

Hi All,

 

I have 3 different table CL (end date, contract id), sales actual ( #actual, dateid, contract id, doc date), and calendar (dateid, year, month, date).

 

They are related like the photo below.

Bwendos_Den_0-1715581475960.png

What I want is that, when I select a month year from calendar, to have sales actual where the End date from CL is until the month before the selected month.

 

do you have any idea on how to solve it?

 

thank you very much for your help

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Bwendos_Den ,

 

The sample measure below will calculate the sales up to before the earliest date of the selected month from the  calendar table.

CALCULATE (
    [sales measure],
    FILTER ( ALL ( 'calendar' ), 'calendar'[Date] < MIN ( 'calendar'[Date] ) )
)

Take note, the sales will be cumulative from the earlierst transaction date. If for just  the current year, try:

CALCULATE (
    [sales measure],
    FILTER (
        ALLEXCEPT ( 'calendar', 'calendar'[YEAR] ),
        'calendar'[Date] < MIN ( 'calendar'[Date] )
    )
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
Bwendos_Den
Frequent Visitor

Hi @danextian thanks for your answer but it is not what what I am looking for, with that I still get the current month

Mmm. That is unexpected. Can you please post a workable sample data (not an image) or a sanitized copy of your pbix. You can post a link to a file in the cloud.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
danextian
Super User
Super User

Hi @Bwendos_Den ,

 

The sample measure below will calculate the sales up to before the earliest date of the selected month from the  calendar table.

CALCULATE (
    [sales measure],
    FILTER ( ALL ( 'calendar' ), 'calendar'[Date] < MIN ( 'calendar'[Date] ) )
)

Take note, the sales will be cumulative from the earlierst transaction date. If for just  the current year, try:

CALCULATE (
    [sales measure],
    FILTER (
        ALLEXCEPT ( 'calendar', 'calendar'[YEAR] ),
        'calendar'[Date] < MIN ( 'calendar'[Date] )
    )
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.