Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AshDil
Helper V
Helper V

Want to sum up Item ID values based on Category Id and Sub-category Id and show it axis of bar chart

Hi,

 

I have data as follows:

Category IDSub-Category IDITEM IDSales
100110010121000
100210020122000
100310030183000
100110010221200
100110010182000
1002100201181500

 

Now I want Item ID need to be sum up by Category ID and Sub-Category ID, the resultant Item ID need to be used as axis in column chart.

Eg: Category Id = 1001, Sub-category id = 100101 has two Item Id's = 2 & 8 (the resultant item id is sum of 2 and 8 = 10) and Sales Value = 3000

Now I need Item id = 10 to be used in "axis field" and sum of Sales = 3000 in "values field" of column chart. Same need to follow with other Category and Sub-category id's

Note: we don't use Category ID and Sub category Id in column chart.

Please help me to do it.

 

Thanks,

AshDil

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

One of ways to solve this is to create a new table like below.

Please check the below picture and the attached pbix file.

 

Picture4.png

 

New Table =
GROUPBY (
    Data,
    Data[Category ID],
    Data[Sub-Category ID],
    "@AxisItemID", SUMX ( CURRENTGROUP (), Data[ITEM ID] ),
    "@SumSales", SUMX ( CURRENTGROUP (), Data[Sales] )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

One of ways to solve this is to create a new table like below.

Please check the below picture and the attached pbix file.

 

Picture4.png

 

New Table =
GROUPBY (
    Data,
    Data[Category ID],
    Data[Sub-Category ID],
    "@AxisItemID", SUMX ( CURRENTGROUP (), Data[ITEM ID] ),
    "@SumSales", SUMX ( CURRENTGROUP (), Data[Sales] )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


amitchandak
Super User
Super User

@AshDil , A new column

 

Sumx(Filter(Table, [Category Id] = earlier([Category Id]) &&  [Sub-category id] = earlier([Sub-category id]) ), [Item ID] )

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.