cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors