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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
thiagofcs
Frequent Visitor

DAX Logic to repeat value on MAX Date up to the end of 2020 based on a conditional column

Hello, I need help doing the logic in DAX as below

 

Sample Data:

DateTicketKPITypeValue
01/01/2020TICK01KPI01Recurring10
01/02/2020TICK01KPI01Recurring

8

01/01/2020TICK01KPI02No Recurring7
01/02/2020TICK01KPI02No Recurring6
01/01/2020TICK02KPI03Recurring12
01/02/2020TICK02KPI03Recurring13


The DAX Measure should do the logic:


When Type = No Recurring:
-> do nothing, just return the Value column on their respective row.

 

When Type = Recurring:
-> Should get the value on the MAX date for each Ticket/KPI (one ticket can have one or more KPI`s either recurring or no recurring) and repeat this value until the last month of 2020 (01/12/2020)

 

So, for the example above it have to repeat the value on MAX date of TICK01/KPI01 (8) and TICK02/KPI03 (13) up to Dec/2020.

TICK01/KPI02 will have it value as is in the sample table (just for january and february 2020)

 

Thanks in advance,

Thiago

4 REPLIES 4
camargos88
Community Champion
Community Champion

@thiagofcs ,

 

You asked for a conditional column in the title. That's is possible to do with a measure as well.

You can add a filter to the formula till 12/2020 or give us some example of what you need with data (input and output).



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

Proud to be a Super User!



thiagofcs
Frequent Visitor

Hi camargos88.

It`s almost this. But the past months will not get the value on max date. And it should repeat the value on max date only for the future months up to 12/2020. 
I think this should be done in a measure not in a column (maybe some preparation in the column it`s fine) but the measure because we have to join this table with a calendar table that goes up to 12/2021.

 

 

camargos88
Community Champion
Community Champion

@thiagofcs ,

 

Try this code for a new column:

Column = 
IF('Table'[Type] = "No Recurring", 'Table'[Value],
VAR _maxDate = CALCULATE(MAX([Date]), ALLEXCEPT('Table', 'Table'[Ticket], 'Table'[KPI]))
RETURN CALCULATE(SUM('Table'[Value]), FILTER(ALLEXCEPT('Table', 'Table'[Ticket], 'Table'[KPI]), [Date] = _maxDate)))


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

Proud to be a Super User!



thiagofcs
Frequent Visitor

Hi,

Any tip for this one?

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.