Forum Discussion
Calculation Groups help
- 3 months ago
Your calc columns would go like this:
Group = VAR _'Time Intelligence'[Calculation group column] = [Column] RETURN SWITCH ( TRUE (), _Column IN { "MTD", "QTD", "YTD" }, "", _Column IN { "MTD Target", "QTD Target", "YTD Target" }, " ", _Column IN { "£", "%" }, "MTD VAR", _Column IN { "£.", "% " }, "QTD VAR", _Column IN { "£..", "% " }, "YTD VAR", _Column = "Rate", "Daily Run", _Column = "Rate Target", "Daily Run ", _Column IN { "£...", "% " }, "MTD RR VAR" ) Sort = VAR _'Time Intelligence'[Calculation group column] = [Column] RETURN SWITCH ( TRUE (), _Column IN { "MTD", "QTD", "YTD" }, 1, _Column IN { "MTD Target", "QTD Target", "YTD Target" }, 2, _Column IN { "£", "%" }, 3, _Column IN { "£.", "% " }, 4, _Column IN { "£..", "% " }, 5, _Column = "Rate", 6, _Column = "Rate Target", 7, _Column IN { "£...", "% " }, 8 )A custom sort column is needed so the groups follow the same order as shown in the screenshot. Notice the trailing spaces in the grouping values - these are intentional so Power BI treats them as different values, allowing them to appear as separate columns.
Also note the periods. Power BI does not allow multiple calculation items with identical names. A workaround is to replace the period with a zero-width space character, which can be copied from [Unicode Explorer - Zero Width Space](https://unicode-explorer.com/c/200B?utm_source=chatgpt.com).
Since the character is invisible, it can be difficult to work with. After replacing the periods, both calc columns will also need to be updated accordingly.
You should be able to view the calculation group table in data view
Also, the calcuation items can be edited in the model/diagram view
Hi danextian,
What values should the calculated column contain? My column headers have two levels and the first 6 columns the headers are on just 1 level.
Thank You,
M
- danextian3 months agoSuper User
Your calc columns would go like this:
Group = VAR _'Time Intelligence'[Calculation group column] = [Column] RETURN SWITCH ( TRUE (), _Column IN { "MTD", "QTD", "YTD" }, "", _Column IN { "MTD Target", "QTD Target", "YTD Target" }, " ", _Column IN { "£", "%" }, "MTD VAR", _Column IN { "£.", "% " }, "QTD VAR", _Column IN { "£..", "% " }, "YTD VAR", _Column = "Rate", "Daily Run", _Column = "Rate Target", "Daily Run ", _Column IN { "£...", "% " }, "MTD RR VAR" ) Sort = VAR _'Time Intelligence'[Calculation group column] = [Column] RETURN SWITCH ( TRUE (), _Column IN { "MTD", "QTD", "YTD" }, 1, _Column IN { "MTD Target", "QTD Target", "YTD Target" }, 2, _Column IN { "£", "%" }, 3, _Column IN { "£.", "% " }, 4, _Column IN { "£..", "% " }, 5, _Column = "Rate", 6, _Column = "Rate Target", 7, _Column IN { "£...", "% " }, 8 )A custom sort column is needed so the groups follow the same order as shown in the screenshot. Notice the trailing spaces in the grouping values - these are intentional so Power BI treats them as different values, allowing them to appear as separate columns.
Also note the periods. Power BI does not allow multiple calculation items with identical names. A workaround is to replace the period with a zero-width space character, which can be copied from [Unicode Explorer - Zero Width Space](https://unicode-explorer.com/c/200B?utm_source=chatgpt.com).
Since the character is invisible, it can be difficult to work with. After replacing the periods, both calc columns will also need to be updated accordingly.
You should be able to view the calculation group table in data view
Also, the calcuation items can be edited in the model/diagram view