Forum Discussion

Ortignano's avatar
Ortignano
Icon for Helper II rankHelper II
5 years ago
Solved

Create a calendar based in a table

Hi,

I have a shipment table and I create a  calendar from the first date of shipment up to the last date of shipment.

I create a query where the source is 

= fnDateDim(Date.StartOfYear(List.Min(Shipments[Ship date])),Date.EndOfMonth(List.Max(Raw_data[Data_Created_Period])))

 

where fnDateDim create the calendar

Now I would create a similar calendar table but end 6 month before but I'm not able to do it.

 

I try to use

fnDateDim(Date.StartOfYear(List.Min(Shipments[Ship date])),Date.EndOfMonth(List.Max(Date.AddMonths([Data_Created_Period],-6))))

 

but powerbi give me 

Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?

 

Anyone can help me?

Thanks

  • Ortignano , Seem fine. Try like

    fnDateDim(Date.StartOfYear(List.Min(Shipments[Ship date])),Date.AddMonths(Date.EndOfMonth(List.Max([Data_Created_Period])),-6))

1 Reply

  • Ortignano , Seem fine. Try like

    fnDateDim(Date.StartOfYear(List.Min(Shipments[Ship date])),Date.AddMonths(Date.EndOfMonth(List.Max([Data_Created_Period])),-6))