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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
vagelis
Frequent Visitor

Need help with a calculated colum/measure which selects a date and all previous dates

I dont know if this is possible, but thanks for looking if you are able to help. I have a table which contains a column trans_ppyy, date is in format YYYYMM so 202305, 202304 etc, multiples of each as its transactions in a period. its based on a transactional table which should roll up and at the end there is a balance. I need a way that someone can select a specific period  so for example 202205 and my table filters to 202205 and ALL periods before, obviously filtering the table on 202205 will just give transactions in that period so the end balance doesnt match up. Cant figure it out, thanks

2 REPLIES 2
vagelis
Frequent Visitor

thanks for the suggestion but that doesnt work as a solution for my data, I want to give people the ability to select the data with a filter such as below which would then show them the cumulative data based on the selection they make in the trans_ppyy[yr_period] filter , I think my logic is right but doesnt give me the correct returns in the calc column

 

 

FilteredData =
VAR SelectedPeriod = MAX('trans_ppyy'[yr_period])
VAR CurrentPeriod = 'Period_End_Check'[trans_ppyy]
RETURN
    IF(
        CurrentPeriod <= SelectedPeriod,
        1,
        0
    )

 

 

 

johnt75
Super User
Super User

You can create a measure like

Balance =
VAR MaxDate =
    MAX ( 'Date'[Date] )
VAR Result =
    CALCULATE ( SUM ( 'Table'[Amount] ), 'Date'[Date] <= MaxDate )
RETURN
    Result

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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