cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mafia7759 Frequent Visitor
Frequent Visitor

Conditional Column for Data

Hello,

 

I'm working with a data extracted from here : "http://www.sii.cl/valores_y_fechas/uf/uf2018.htm". It shows the value of UF through time and I successfully transformed it to just two columns so I can call it correctly to another base when i have to transform $ to UF just by dividing $/value UF. The thing is my boss told me that for months that have passed i only need to use the UF value of the last day of the month and in the current month that now is November I have to use the value of UF of each day ( until it finishes and its the same as the others, use just the value of the end of the month).

 

What i have.png

 

This is the transformed data that only has 2 columns. The value of UF in Pesos $, and the date next to it by days.

 

I was think a condition that maybe sets "if its January , equals to value UF o last day of month january" and create a new column with the condition.

 

what i want.png

 

Like this.

 

Thank you in Advance.

1 REPLY 1
Community Support Team
Community Support Team

Re: Conditional Column for Data

hi, @Mafia7759

After my test, you could try these steps as below:

Step1:

Add a Year Month Number column for date

Year Month Number = YEAR(Table1[Date])*100+MONTH(Table1[Date])

Step2:

Add a result column 

get last day each month = var _lastday=CALCULATE(MAX(Table1[Date]),FILTER(Table1,Table1[Year Month Number]=EARLIER(Table1[Year Month Number]))) return
CALCULATE(SUM(Table1[Value]),FILTER(Table1,Table1[Date]=_lastday))

9.JPG

 

 

Best Regards,
Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.