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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
tecumseh
Resolver II
Resolver II

Return Select Columns As Last Step In Calculated Table

Hi,

In my Calculated Table, I return all dates for Sales and calculate the quarter for each date.
Now I want to return just the Customer id and Quarter

However DAX is telling me it cannot find the intermediary table I used to calculate the quarter for each date.

How can I get just the customer id and the quarter in my final calc table?

Thanks

Table_x = 
VAR T10 =
FILTER(
Sales,
Sales[Channel] = "Education" &&
Sales[Customer ID] <> "Adjustments" &&
Sales[Net Revenue] > 0
)
VAR T20 =
SUMMARIZECOLUMNS(
Sales[Customer ID],
Sales[Date],
T10
)
VAR T30 =
ADDCOLUMNS(
T20,
"Quarter",
DATE(YEAR(Sales[Date]),ROUNDUP( DIVIDE( MONTH( Sales[Date] ),3 ),0 ) *3 -2, 1)
)
VAR T40 =
SELECTCOLUMNS(
T30,
"Customer ID", T30[Customer ID],
"Quarter", T30[Quarter]
)


RETURN
T40





1 ACCEPTED SOLUTION
foodd
Super User
Super User

This was written on a phone and is untested.  You may need to change the DAX as necessary.  This is related to the context transition, which can cause intermediate tables to be unavailable for use in later steps of the calculation. To achieve the desired result, you can simplify the DAX code and perform the date calculations directly within the SELECTCOLUMNS function. Try this

 

Table_x =
VAR T10 =
FILTER(
Sales,
Sales[Channel] = "Education" &&
Sales[Customer ID] <> "Adjustments" &&
Sales[Net Revenue] > 0
)
VAR T40 =
SELECTCOLUMNS(
T10,
"Customer ID", Sales[Customer ID],
"Quarter", DATE(YEAR(Sales[Date]), ROUNDUP(DIVIDE(MONTH(Sales[Date]), 3), 0) * 3 - 2, 1)
)
RETURN
T40

View solution in original post

1 REPLY 1
foodd
Super User
Super User

This was written on a phone and is untested.  You may need to change the DAX as necessary.  This is related to the context transition, which can cause intermediate tables to be unavailable for use in later steps of the calculation. To achieve the desired result, you can simplify the DAX code and perform the date calculations directly within the SELECTCOLUMNS function. Try this

 

Table_x =
VAR T10 =
FILTER(
Sales,
Sales[Channel] = "Education" &&
Sales[Customer ID] <> "Adjustments" &&
Sales[Net Revenue] > 0
)
VAR T40 =
SELECTCOLUMNS(
T10,
"Customer ID", Sales[Customer ID],
"Quarter", DATE(YEAR(Sales[Date]), ROUNDUP(DIVIDE(MONTH(Sales[Date]), 3), 0) * 3 - 2, 1)
)
RETURN
T40

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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