Forum Discussion
insert grand total in chart
- 4 years ago
Hi gustavoluis ,
I originally proposed a disconnected table but after checking on your pbix, I've decided to skip that. I've also modified the formula for the calculated table to account for the week column being a number while "Total" is a text string. Please refer to this pbix - https://drive.google.com/file/d/14CXYQUEz94fIZStO1TUk7j9mNGJ8seYL/view?usp=sharing
Hi gustavoluis ,
For this, you would have to make use a disconnected (no relationship with Facts/Dimension tables) table that contains all the unique items in a column (week number, etc) plus another row for Total and use that column in a visual.
Sample calculated table to create a disconnected table.
Categories with total =
VAR __CAT =
ADDCOLUMNS ( DISTINCT ( Data[Category] ), "Sort", BLANK () )
VAR __TOTAL =
ROW ( "Category", "Total", "Sort", 10 )
//Sort column to be used to sort the Category column by where Total is the last one in ascending order. The rest are sorted alphabetically.
RETURN
UNION ( __CAT, __TOTAL )
Sample measure to include the total.
Sum of Value with total =
VAR __CAT =
SELECTEDVALUE ( 'Categories with total'[Category] )
VAR __TOTAL =
CALCULATE ( [Sum of Value], ALLSELECTED ( Data[Category] ) )
RETURN
IF (
__CAT = "Total",
__TOTAL,
CALCULATE (
[Sum of Value],
Data[Category] = SELECTEDVALUE ( 'Categories with total'[Category] )
)
)
sample result
sample pbix
https://drive.google.com/file/d/1oUR5D1YftbCs8gDLDnxYq_QjYJmKhqhM/view?usp=sharing
thanks
but I couldn't do it.
how do you make the x axis of the graph be the week of the year
and grand total being the sum of the selected weeks,
can you help me danextian
my pbix
https://drive.google.com/file/d/1mXzoAizBuwGrWdTs0EPSEgChM_rtKRb9/view?usp=sharing
- danextian4 years ago
Super User
Hi gustavoluis ,
I originally proposed a disconnected table but after checking on your pbix, I've decided to skip that. I've also modified the formula for the calculated table to account for the week column being a number while "Total" is a text string. Please refer to this pbix - https://drive.google.com/file/d/14CXYQUEz94fIZStO1TUk7j9mNGJ8seYL/view?usp=sharing