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
Dean1972
Frequent Visitor

DAX help - Calendar Help

Please could i ask for your help,

I have created tables for all the other columns but keep getting a issues the created filed????

Info:

 

Table One

 

PRJSTRequests Created =

UNION (  

   ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('PRJSTRequests' , DATESBETWEEN('PRJSTRequests'[Created],today()-07+1,today()) ),

'PRJSTRequests'[Created]),"Period","Last 07 Days") ,

   ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('PRJSTRequests' , DATESBETWEEN('PRJSTRequests'[Created],today()-14+1,today()) ),

'PRJSTRequests'[Created]),"Period","Last 14 Days") ,

   ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('PRJSTRequests' , DATESBETWEEN('PRJSTRequests'[Created],today()-30+1,today()) ),

'PRJSTRequests'[Created]),"Period","Last 30 Days") ,

   ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('PRJSTRequests' , DATESBETWEEN('PRJSTRequests'[Created],today()-60+1,today()) ),

'PRJSTRequests'[Created]),"Period","Last 60 Days") ,

   ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('PRJSTRequests' , DATESBETWEEN('PRJSTRequests'[Created],today()-90+1,today()) ),

'PRJSTRequests'[Created]),"Period","Last 90 Days") ,

   ADDCOLUMNS( SUMMARIZE( CALCULATETABLE('PRJSTRequests'), 'PRJSTRequests'[Created]),"Period","Overall")

)

 

I get the following error

 

"A date column containing duplicate dates was specified in the call to function 'DATESBETWEEN'. This is not supported.The current operation was cancelled because another operation in the transaction failed."

 

Table Two - Linking table

 

PRJSTRequests Created Date = CALENDAR("09/10/2000",TODAY())

 

DAX Data XLS.JPG

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @Dean1972,

 

As we can see from your formula, it has nothing to do with the column 'PRJSTRequests'[Created]. So we can create a independent Date table. 

1. Create a date table.

Calendar =
CALENDAR ( DATE ( 2017, 01, 1 ), DATE ( 2017, 12, 31 ) )

2. Create a new column of 'PRJSTRequests' due to there is a time part in the [Created].

NewCreated = [Created].[Date]

3. Try this formula. You can try it in this file: https://1drv.ms/u/s!ArTqPk2pu-BkgS-yaLt1FR6zDe4w

PRJSTRequests Created =
UNION (
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 07 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 07 Days"
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 14 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 14 Days"
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 30 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 30 Days"
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 60 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 60 Days"
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 90 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 90 Days"
    ),
    ADDCOLUMNS ( VALUES ( 'PRJSTRequests'[NewCreated] ), "Period", "Overall" )
)

DAX help - Calendar Help.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.

View solution in original post

1 REPLY 1
v-jiascu-msft
Employee
Employee

Hi @Dean1972,

 

As we can see from your formula, it has nothing to do with the column 'PRJSTRequests'[Created]. So we can create a independent Date table. 

1. Create a date table.

Calendar =
CALENDAR ( DATE ( 2017, 01, 1 ), DATE ( 2017, 12, 31 ) )

2. Create a new column of 'PRJSTRequests' due to there is a time part in the [Created].

NewCreated = [Created].[Date]

3. Try this formula. You can try it in this file: https://1drv.ms/u/s!ArTqPk2pu-BkgS-yaLt1FR6zDe4w

PRJSTRequests Created =
UNION (
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 07 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 07 Days"
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 14 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 14 Days"
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 30 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 30 Days"
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 60 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 60 Days"
    ),
    ADDCOLUMNS (
        SUMMARIZE (
            CALCULATETABLE (
                'Calendar',
                DATESBETWEEN ( 'Calendar'[Date], TODAY () - 90 + 1, TODAY () )
            ),
            'Calendar'[Date]
        ),
        "Period", "Last 90 Days"
    ),
    ADDCOLUMNS ( VALUES ( 'PRJSTRequests'[NewCreated] ), "Period", "Overall" )
)

DAX help - Calendar Help.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.

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.