Forum Discussion
Calculated measure subtotal based on dimensions
Here is my require ment to create clustered column chart and i have the below fields for ex
1.Tower - This is for legend
2. Aging Bucket - This is for Xaxis
3.Number of incidents - This is for values
Below is the screen shot for reference, Kindly help me to acheive this in my second working chart.
Reference Chart
Working chart
Thanks in Advance,
Krish
Hi Anonymous ,
We can create two dim table and a measure to meet your requirement:
Axis Table:
Axis Table = ADDCOLUMNS ( UNION ( DISTINCT ( 'Table'[Day] ), { "Grand Total" } ), "Sort", SWITCH ( [Day], "<24 Hrs", 1, "1 - 3 Days", 2, "4 - 7 Days", 3, "8 - 15 Days", 4, "16 - 30 Days", 5, "31 - 60 Days", 6, 10 ) )Category Table:
Category Table = ADDCOLUMNS ( UNION ( DISTINCT ( 'Table'[Category] ), { "Grand Total" } ), "Sort", SWITCH ( [Category], "Apps", 1, "BSTAR", 2, "INFRA", 3, 10 ) )Amount Measure:
Amount Measure = SUMX ( DISTINCT ( 'Axis Table'[Day] ), VAR d = [Day] RETURN SWITCH ( [Day], "Grand Total", SUMX ( DISTINCT ( 'Category Table'[Category] ), VAR c = [Category] RETURN SWITCH ( [Category], "Grand Total", CALCULATE ( SUM ( 'Table'[Amount] ) ), CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Category] = c ) ) ), SUMX ( DISTINCT ( 'Category Table'[Category] ), VAR c = [Category] RETURN SWITCH ( [Category], "Grand Total", CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Day] = d ), CALCULATE ( SUM ( 'Table'[Amount] ), FILTER ( 'Table', 'Table'[Category] = c && 'Table'[Day] = d ) ) ) ) ) )
If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.
Best regards,
4 Replies
- Greg_DecklerCommunity Champion
Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
- amitchandakSuper User
Anonymous , Can you tell what is that you are not able to get
- v-lid-msftCommunity Support
Hi Anonymous ,
We can create two dim table and a measure to meet your requirement:
Axis Table:
Axis Table = ADDCOLUMNS ( UNION ( DISTINCT ( 'Table'[Day] ), { "Grand Total" } ), "Sort", SWITCH ( [Day], "<24 Hrs", 1, "1 - 3 Days", 2, "4 - 7 Days", 3, "8 - 15 Days", 4, "16 - 30 Days", 5, "31 - 60 Days", 6, 10 ) )Category Table:
Category Table = ADDCOLUMNS ( UNION ( DISTINCT ( 'Table'[Category] ), { "Grand Total" } ), "Sort", SWITCH ( [Category], "Apps", 1, "BSTAR", 2, "INFRA", 3, 10 ) )Amount Measure:
Amount Measure = SUMX ( DISTINCT ( 'Axis Table'[Day] ), VAR d = [Day] RETURN SWITCH ( [Day], "Grand Total", SUMX ( DISTINCT ( 'Category Table'[Category] ), VAR c = [Category] RETURN SWITCH ( [Category], "Grand Total", CALCULATE ( SUM ( 'Table'[Amount] ) ), CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Category] = c ) ) ), SUMX ( DISTINCT ( 'Category Table'[Category] ), VAR c = [Category] RETURN SWITCH ( [Category], "Grand Total", CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Day] = d ), CALCULATE ( SUM ( 'Table'[Amount] ), FILTER ( 'Table', 'Table'[Category] = c && 'Table'[Day] = d ) ) ) ) ) )
If it doesn't meet your requirement, kindly share your sample data and expected result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.
Best regards, - v-lid-msftCommunity Support
Hi Anonymous ,
How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?
Best regards,