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
Mafia7759
New Member

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
v-lili6-msft
Community Support
Community Support

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.

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.