Forum Discussion
Alternative Dax for Calculated Column?
- 10 months ago
Try creating a calculated table for your dimension:
Period Alias Dim =
SUMMARIZE(
v_flt_enrollment,
v_flt_enrollment[ag_level],
v_flt_enrollment[fiscal_nbr_in_year],
"Period Alias",
SWITCH(
v_flt_enrollment[ag_level],
"DAILY", "DAY " & v_flt_enrollment[fiscal_nbr_in_year],
"WEEKLY", "WK " & v_flt_enrollment[fiscal_nbr_in_year],
"MONTHLY", "MNTH " & v_flt_enrollment[fiscal_nbr_in_year],
"QTR", "QTR " & v_flt_enrollment[fiscal_nbr_in_year],
"YEARLY", "FY",
"CHECK"
)
)Then use this table in your visual instead.
Hi lauriedata, did I understand correctly that your original data looks similar to this:
and you are trying to create a chart similar to this one?
You could add the column via SQL - either directly in the source if possible (since I assume that v_flt_enrollment is a view) or via the advanced section in the connection itself:
select
*,
CASE ag_level
WHEN 'DAILY' THEN 'DAY ' + CAST(fiscal_nbr_in_year AS varchar(10))
WHEN 'WEEKLY' THEN 'WK ' + CAST(fiscal_nbr_in_year AS varchar(10))
WHEN 'MONTHLY' THEN 'MNTH ' + CAST(fiscal_nbr_in_year AS varchar(10))
WHEN 'QTR' THEN 'QTR ' + CAST(fiscal_nbr_in_year AS varchar(10))
WHEN 'YEARLY' THEN 'FY'
ELSE 'CHECK'
END AS Period_Alias
from dbo.v_flt_enrollmentAfter that you can remove the regular "Navigation" step that would navigate to the table:
Final result:
=> Close + apply
I appreciate that. I was trying to avoid another column in the source by approaching with Dax. We are using databricks and while I can convert in a query, I have been asked to either create in Dax or request source changes from the developer (i.e. not in a query source). Not sure why, but too busy to argue.