Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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
Solved! Go to Solution.
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
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
User | Count |
---|---|
82 | |
78 | |
67 | |
46 | |
45 |
User | Count |
---|---|
105 | |
44 | |
39 | |
39 | |
39 |