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
Norbertus
Helper V
Helper V

results till last month

Hi, 

 

maybe simple, but it doesn't work for me

 

I have a page where the reportuser can select a year and a monthname
Now i want a visual that shows all results per month that is before the selected month

 

For example: Select year = 2023 and month = March

The result has to be

Januari 2023 = xxx

Febrari 2023 = xxx

March 2023 = Nothing


Measure: 

 

# Measure till month = 

VAR __maxdate = MAX('Dim Calendar'[Month])
VAR __Month  = 

CALCULATE(
    __maxdate,
    REMOVEFILTERS('Dim Calendar'[MonthName])
)

VAR result = 

CALCULATE(
    [# Items], 
    KEEPFILTERS(
        FILTER(
            ALL('Dim Calendar'),
            'Dim Calendar'[Year] = MAX('Dim Calendar'[Year]) && 'Dim Calendar'[Month] <= __Month
        )
    ), REMOVEFILTERS('Dim Calendar'[MonthName])
)

RETURN

result

 


Hope someone can help me


With kind regards

1 REPLY 1
amitchandak
Super User
Super User

@Norbertus , Try a measure like with help from date table

 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=eomonth(max('Date'[date]) ,-1) ))

 

You can also try window function

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

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.