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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
fabiojoa
Helper I
Helper I

#Error when a new column added in a Calendar

Hi,

 

I create a Calendar using a below code:

dcalendar3 =

            ADDCOLUMNS(

                CALENDARAUTO();

                "Ano";FORMAT([Date];"YYYY");

                "Mês";FORMAT([Date];"MMMM");

                "Mês Curto";FORMAT([Date];"MMM");

                "Núm Mês";MONTH([Date]);

                "Trimestre";FORMAT([Date];"q");

                "Mês/Ano";FORMAT(([Date]);"mmm") & "/" & YEAR([Date]);

                "Ano Mês"; CONCATENATE(YEAR([Date]);FORMAT(MONTH([Date]);"00"));

                "Dia da Semana";FORMAT([Date];"ddd");

                "Núm Dia Semana";WEEKDAY([Date]);

                "Dia Útil"; SWITCH(WEEKDAY([Date]);7;0;1;0;1);

                "Feriado";LOOKUPVALUE(Feriados[Feriado];Feriados[Data];[Date];"")

            )

Captura de tela 2020-02-05 16.17.45.png

 

I need to add a column to check if it's a business day or a holiday. And I'm using the following code for this:

Dias úteis sem Feriados = if(AND(dcalendar3[Dia Útil]=1;dcalendar3[Feriado]="");"Dia útil";"Dia não útil")

 

Captura de tela 2020-02-05 16.25.59.png

 

Sometimes when I add a new column, it causes an error in all the data in the column. It has already happened, for example, when I refer to one of the columns in the calendar, as is the case now. This time I had no mistakes, but they often haunt me.

 

Thanks!

1 ACCEPTED SOLUTION

I was making a basic mistake !!! You simply should have added the last column formula calculated within the one that created the calendar. So it stopped causing the error that happened when creating the new column.
I thank you in advance for the effort and attention of those who read this request!

View solution in original post

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

HI  @fabiojoa 

Whta is error in your case? from the screenshot, it works well. and if is something wrong in your formula.

Could you please share your sample pbix file for us have a test.

 

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.

Hi!

 

Finally the error occurred, this morning when I opened the file ...

 

Captura de tela 2020-02-06 10.33.40.png

 

The column with my formula to find out if it is a working day or a weekend / holiday disappears and this one appears in error.

 

PBI FILE

 

Thanks!

I was making a basic mistake !!! You simply should have added the last column formula calculated within the one that created the calendar. So it stopped causing the error that happened when creating the new column.
I thank you in advance for the effort and attention of those who read this request!

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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