Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare 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
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
97 | |
93 | |
87 | |
68 |
User | Count |
---|---|
173 | |
134 | |
132 | |
102 | |
95 |