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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
123abc
Community Champion
Community Champion

how to calculate collective performance of multiple accounts of sales and target for single customer

Hi Experts,

 

I wants to calculate a column or dax measure for to calculate group of dealers sales and target, in my working one dealer / customer has multiple accounts in which they are invoicing and singned targets, i wants to calculate their collective sales in next column and collective target in next column and then to calculate their achievmeent % agaisnt collective targets and sales and if dealers has only one account then measure shows only his single accounts sales and target in next columns but if have multiple accounts the shows collectively.

 

But i have thousands and customer and rows database based on this type of challenge.

 

I have done this in excel file (File is attached) but how to do in Power BI with caculated column or dax measure please guide.

 

In excel i am doing this like:

M/s Afzal has 11 accounts in which they are invoicing and has singed their targets accross the countary, i assigned Group name "AFZAL" in column 1 to every ID, then in next column mentions "G" against every group name (Column 2) and then mention "H" head of all accounts in next column (Column 3). Now the formula works as it combine all "Afzal" named sales or target against "H" in seperated columns called individual total target or sales after grouping.

 

Excel sampling picture .... reference file of excel and pbix is also attacehd in one drive:

https://drive.google.com/file/d/1TnJK8-PnseCsouKwotBEGWpVYinDFwmG/view?usp=sharing

 

sample group working excel.jpg

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

Not clear to me what you are trying to accomplish.  Do you want to show the group target only for the H row?

 

lbendlin_0-1724378079378.png

 

View solution in original post

123abc
Community Champion
Community Champion

Group Sales =
VAR CurrentGroup = PlanningTable[Group Name]
VAR IsGroupHead = PlanningTable[Group Head "H"] = "H"
VAR TotalSalesForGroup =
CALCULATE(
SUM(PlanningTable[Sales]),
FILTER(
ALL(PlanningTable),
PlanningTable[Group Name] = CurrentGroup
)
)
VAR GroupHasHead =
CALCULATE(
COUNTROWS(PlanningTable),
FILTER(
ALL(PlanningTable),
PlanningTable[Group Name] = CurrentGroup &&
PlanningTable[Group Head "H"] = "H"
)
) > 0
RETURN
IF(
IsGroupHead,
TotalSalesForGroup,
IF(
GroupHasHead,
BLANK(),
PlanningTable[Sales]
)
)

 

 

This measure has solved my issue ... but tahnk you so much for your support.

 

This formula ensures that only the "H" account in a group displays the total group sales, while other group members show as blank. For accounts not part of any group, their individual sales will be shown.

 

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

Not clear to me what you are trying to accomplish.  Do you want to show the group target only for the H row?

 

lbendlin_0-1724378079378.png

 

123abc
Community Champion
Community Champion

Group Sales =
VAR CurrentGroup = PlanningTable[Group Name]
VAR IsGroupHead = PlanningTable[Group Head "H"] = "H"
VAR TotalSalesForGroup =
CALCULATE(
SUM(PlanningTable[Sales]),
FILTER(
ALL(PlanningTable),
PlanningTable[Group Name] = CurrentGroup
)
)
VAR GroupHasHead =
CALCULATE(
COUNTROWS(PlanningTable),
FILTER(
ALL(PlanningTable),
PlanningTable[Group Name] = CurrentGroup &&
PlanningTable[Group Head "H"] = "H"
)
) > 0
RETURN
IF(
IsGroupHead,
TotalSalesForGroup,
IF(
GroupHasHead,
BLANK(),
PlanningTable[Sales]
)
)

 

 

This measure has solved my issue ... but tahnk you so much for your support.

 

This formula ensures that only the "H" account in a group displays the total group sales, while other group members show as blank. For accounts not part of any group, their individual sales will be shown.

 

123abc
Community Champion
Community Champion

Thank you very much  lbendlin for your such support,  yes you reached on my problem, i want to show the group target against "H" in Group Targret Column and if any one has not "H" (mean he is not the part of any group) then his individual target will show in Group Target column.  please guide how to do this.

 

Regards:

Ali Abbas

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.