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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
RobbeVL90
Frequent Visitor

DAX - Generate

Hi, I have a Calculated Table that seems to be working almost fine : 

 

EVALUATE
	VAR Today = TODAY()
	VAR MaxTerms = DATEDIFF(
		MIN('DIM_SalesforceProject'[GoLiveDate]),
		Today,
		YEAR
	)
	RETURN
		ADDCOLUMNS(
			GENERATE(
				GENERATESERIES(
					1,
					MaxTerms
				),
				SELECTCOLUMNS(
					'DIM_SalesforceProject',
					"Contract_StartDate",
					'DIM_SalesforceProject'[GoLiveDate],
					"ProjectCode",
					'DIM_SalesforceProject'[ProjectCode]
				)
			),
			"Term_StartDate", DATEADD(
				'DIM_SalesforceProject'[GoLiveDate],
				[Value] - 1,
				YEAR
			),
			"Term_EndDate", DATEADD(
				'DIM_SalesforceProject'[GoLiveDate],
				[Value] ,
				YEAR
			) - 1
		)

 

 

The result of this is the following : 

RobbeVL90_1-1708510114604.png

 

For some reason, future dates are not showing. 
Its like the "Value" Column  is returning Blank, but I dont get why. 

Any Help ? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @RobbeVL90 ,

Please update the formula of calculated table as below and check if it can return the expected result... Please find the details in the attachment.

EVALUATE
VAR Today =
    TODAY ()
VAR MaxTerms =
    DATEDIFF ( MIN ( 'DIM_SalesforceProject'[GoLiveDate] ), Today, YEAR )
RETURN
    ADDCOLUMNS (
        GENERATE (
            GENERATESERIES ( 1, MaxTerms ),
            SELECTCOLUMNS (
                'DIM_SalesforceProject',
                "Contract_StartDate", 'DIM_SalesforceProject'[GoLiveDate],
                "ProjectCode", 'DIM_SalesforceProject'[ProjectCode]
            )
        ),
        "Term_StartDate",
            EDATE ( [Contract_StartDate], ( [Value] - 1 ) * 12 ),
        "Term_EndDate",
            EDATE ( [Contract_StartDate], [Value] * 12 ) - 1
    )

vyiruanmsft_1-1708584377354.png

Best Regards

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @RobbeVL90 ,

Please update the formula of calculated table as below and check if it can return the expected result... Please find the details in the attachment.

EVALUATE
VAR Today =
    TODAY ()
VAR MaxTerms =
    DATEDIFF ( MIN ( 'DIM_SalesforceProject'[GoLiveDate] ), Today, YEAR )
RETURN
    ADDCOLUMNS (
        GENERATE (
            GENERATESERIES ( 1, MaxTerms ),
            SELECTCOLUMNS (
                'DIM_SalesforceProject',
                "Contract_StartDate", 'DIM_SalesforceProject'[GoLiveDate],
                "ProjectCode", 'DIM_SalesforceProject'[ProjectCode]
            )
        ),
        "Term_StartDate",
            EDATE ( [Contract_StartDate], ( [Value] - 1 ) * 12 ),
        "Term_EndDate",
            EDATE ( [Contract_StartDate], [Value] * 12 ) - 1
    )

vyiruanmsft_1-1708584377354.png

Best Regards

bhelou
Responsive Resident
Responsive Resident

try this : 

EVALUATE
VAR Today = TODAY()
VAR MaxTerms = DATEDIFF(
MIN('DIM_SalesforceProject'[GoLiveDate]),
Today,
YEAR
)
RETURN
ADDCOLUMNS(
GENERATE(
GENERATESERIES(
1,
MaxTerms
),
SELECTCOLUMNS(
'DIM_SalesforceProject',
"Contract_StartDate", 'DIM_SalesforceProject'[GoLiveDate],
"ProjectCode", 'DIM_SalesforceProject'[ProjectCode]
)
),
"Value", [Value],
"Term_StartDate", DATEADD(
'DIM_SalesforceProject'[GoLiveDate],
[Value] - 1,
YEAR
),
"Term_EndDate", DATEADD(
'DIM_SalesforceProject'[GoLiveDate],
[Value],
YEAR
) - 1
)

Only throws an obvious error. 
I cannot refer to a colum added. 
For some reason Go Live Date is "blank" for future dates...

bhelou
Responsive Resident
Responsive Resident

hi , please share some sample of the pbix to go more

Hi,

Its fairly straight forward. 
Its just 2 values like my exampe : 
"GoLiveDate"  & "PartnerCode"

01/07/2022 0ngNDS2zvw

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.