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
emveha
Resolver III
Resolver III

dax calendar eomonth min/max

hi all,

 

am trying to create a table with all dates of a year and did it like this:

yrCalendar= CALENDAR(EOMONTH(MIN('Treg'[ActivityDate]),-1)+1,EOMONTH(MAX('Treg'[ActivityDate]),0)) but i get an error message= The syntax for '.0' is incorrect. DAX(CALENDAR(EPOMONTH(MIN( etc etc))

Why do i get this message and what do i need to do to solve it.

thnx

Mrt

 

1 ACCEPTED SOLUTION

Hi @emveha,

 

Try this formula please.

dCalendar02 =
CALENDAR (
    EOMONTH ( MIN ( 'Time registration'[ActivityDate] ); -1 ) + 1;
    EOMONTH ( MAX ( 'Time registration'[ActivityDate] ); 0 )
)

Best Regards!

Dale

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

View solution in original post

16 REPLIES 16
gooranga1
Power Participant
Power Participant

I just tried it on a test dataset here and it works okay

 

dCalendar02 = CALENDAR(EOMONTH(min(Query1[event_timestamp]),-1)+1,EOMONTH(max(Query1[event_timestamp]),0))

from your error message it would seem that that the error is because of a full stop before your zero rather than a comma in the final EOMONTH function?

again, it s strange that someone else just informed me that for him/her it works.....

this is my function:

dCalendar02 = CALENDAR(EOMONTH(min('Treg'[ActivityDate]),-1)+1,EOMONTH(MAX('Treg'[ActivityDate]),0))

what is strange is, is the fact that after i have entered my function, the comma next to the first ActivityDate is changed from a comma to a semi column....

dCalendar02 = CALENDAR(EOMONTH(min('Treg'[ActivityDate]);-1)+1, etccc

Hi @emveha,

 

It's hard for me to tell why the change happened. Formats in Power BI connect to "Formats" in the local computer. According to the error message "..syntax...", maybe it's something wrong with ";" or "," in the formula. (This picture just shows one example)

BTW, the formula works well.

dax calendar eomonth minmax.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards!

Dale

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

hi,

changed my regional settings but still the same error...

Any ideas that would help solving this?

thnx

emveha

@emveha

 

Hi Emveha,

 

Could you please post a snapshot about the error here?

 

Best Regards!

Dale

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

error mssg calendar.png

hope this will help...

Hi @emveha,

 

Try this formula please.

dCalendar02 =
CALENDAR (
    EOMONTH ( MIN ( 'Time registration'[ActivityDate] ); -1 ) + 1;
    EOMONTH ( MAX ( 'Time registration'[ActivityDate] ); 0 )
)

Best Regards!

Dale

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

@v-jiascu-msft

 

How would the expression change if I have 3 tables with dates and

try to create a calendar with the minimum date of all 3 tables to

the maximum date of all 3 tables on a month level?

 

Many thanks,

 

H

Hi @hidenseek9,

 

There is a wonderful function called "Calendarauto". Please try it. Reference: MAX-amp-MIN-Dates-from-Multiple-tables and https://msdn.microsoft.com/en-us/library/dn802534.aspx

DateTable =
CALENDARAUTO ()

Best Regards!

Dale

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

@v-jiascu-msft

 

I simply copied and pasted the formula.

However, it did not work.

I created a new table with below formula and it did not work.

 

Would I need to add below formula in each of the 3 tables that I have?

I have a difficult time understanding the formula below.

 

Please help.

 

Many thanks,

 

H

 

 

ADDCOLUMNS (
CALENDARAUTO(),
"Year", YEAR ( [Date] ),
"QuarterOfYear", "Q" & FORMAT ( [Date], "Q" ),
"MonthOfYear", FORMAT ( [Date], "MM" ),
"MonthInCalendar", FORMAT ( [Date], "mmm YYYY" ),
"QuarterInCalendar", "Q" & FORMAT ( [Date], "Q" ) & " " & FORMAT ( [Date], "YYYY" ),
"DayInWeek", WEEKDAY ( [Date] ),
"DayOfWeekName", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" ),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"RelativeYear", (YEAR(NOW())- YEAR ( [Date] )))

Hi @hidenseek9

 

What's the error message? Are the data type of these date column "DateTime"?

 

Best Regards!

Dale

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

@v-jiascu-msft

 

Please find below as the error message.

Appreciate your support!

 

2017-09-15 11_41_29-CAB to CAF Dashboard - Power BI Desktop.png

 

H

Hi @hidenseek9,

 

Please check these items below.

1. Are all your tables calculated tables, which are created through "New Table" button?

2. Are the data type of all the date columns "DateTime"? Can't be "Text".

 

If it's convenient for you, please provide the PBIX file.

 

Best Regards!

Dale

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

@v-jiascu-msft

 

Oh okay. A calculated table was the issue.

It works beautifully now!

Awesome!

 

Thanks,

 

H

vanessafvg
Super User
Super User

@emveha works find for me are you creating a new table?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




yes, want to create a new table.....

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.

Top Solution Authors