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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
EnderWiggin
Helper I
Helper I

Create calendar column value based on a criteria

Hi All,

I would like to ask your help to create a calendar column (BeforeActualYearMonth) based on the following criteria:

If the  Calendar[YearMonth] < LoadedAt[YearMonth] then Calendar[BeforeActualYearMonth] = "BeforeActual" else Calendar[BeforeActualYearMonth] = Calendar[YearMonth]  in each row in Calendar table.

EnderWiggin_0-1626338248283.png

 

 

Please, see the attached file for more details:

 

Power BI Running Total 

PS: It is neccessary to calculate start balance of all material quanity in running total calculation.

 

Thank you very much in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

 

BeforeActualYearMonth =
var CalendarYearMonth = Calendar[YearMonth]
// There must be just one value in LoadedAt
var LoadedAtYearMonth = SELECTEDVALUE( LoadedAt[YearMonth] )
return
	if ( CalendarYearMonth < LoadedAtYearMonth,
		"BeforeActual",
		// CalendarYearMonth must be turned into
		// a string since you can't mix types
		// in a column. If it's already text,
		// you can just use the raw value without >& ""<.
		CalendarYearMonth & ""
	)

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

 

BeforeActualYearMonth =
var CalendarYearMonth = Calendar[YearMonth]
// There must be just one value in LoadedAt
var LoadedAtYearMonth = SELECTEDVALUE( LoadedAt[YearMonth] )
return
	if ( CalendarYearMonth < LoadedAtYearMonth,
		"BeforeActual",
		// CalendarYearMonth must be turned into
		// a string since you can't mix types
		// in a column. If it's already text,
		// you can just use the raw value without >& ""<.
		CalendarYearMonth & ""
	)

 

This is what I want, thank you @Anonymous!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.