Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
104 | |
99 | |
97 | |
41 | |
38 |
User | Count |
---|---|
151 | |
123 | |
79 | |
73 | |
71 |