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
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
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.