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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
SoufTC
Helper I
Helper I

Sum totals of subcategory

I’m having trouble to sum totals of subcategory

 

I have two tables.

1. A table that defines unique FaceBook pages names (repository)[Page] and the name of the person responsible for the page(repository)[RESP CONTENT]

 

repository

 

|   Page       |  RESP CONTENT |
---------------------------------
|   P1          |      RESP1             |
|   P2          |      RESP1             |
|   P3          |      RESP2             |
|   P4          |      RESP2             |
|   P5          |      RESP3             |
|   P6          |      RESP5             |
|   P7          |      RESP5             |
|   P8          |      RESP5             |
|   ....           |         .....               |

 

2. A table of the number of likes(FaceBook)[Likes] and followers(FaceBook)[Followers] per week (FaceBook)[Date]. The join with the (repository)table is done with the (FaceBook)[Page]

 

FaceBook

 

|   Page       |  Likes      |   Followers    |  Date          |

------------------------------------------------------

 | P1            |      32     |         50        |   2021-02-02

 | P1            |      40     |         60        |   2021-02-09

 | P1            |      70     |         100      |   2021-02-16

 | P2            |      80     |        150       |   2021-02-02

 | P2            |      90     |         250      |   2021-02-09

 | P2            |      150   |         350      |   2021-02-16

 | P3            |      10     |         50        |   2021-02-02

 | P3            |      32     |         50        |   2021-02-09

 | P3            |     50      |         80        |   2021-02-16

 

 

What I am expecting are results like:

RESP CONTENTLast LikesLast FollowersCommunity
-  RESP1  220  450335
      P1  7010085
      P2 150350250
-  RESP2 50 4045
     P3504045
..................
Total270490380

 

With :

Last Likes =
CALCULATE (
SUM ( FaceBook[Likes] ),
LASTNONBLANK ( FaceBook[Date], SUM ( FaceBook[Likes] ) )
)
 
Last Followers =
CALCULATE (
SUM ( FaceBook[Followers] ),
LASTNONBLANK ( FaceBook[Date], SUM ( FaceBook[Followers] ) )
)
 
COMMUNITY = IF(
COUNTROWS(VALUES(repository[Page]))=1,
DIVIDE([Likes Rank] + [Followers Rank],2),
SUMX(repository[Page], DIVIDE([Likes Rank] + [Followers Rank],2))
)

 

for community measure SUMX can't give me the right result !!

 

Please, any help?

Thank's in advance

1 ACCEPTED SOLUTION
BeaBF
Super User
Super User

@SoufTC I try to write you my measures based on how I interpreted them:

 

LAST_LIKES = SUMX(SUMMARIZE(repository, repository[Page], repository[RESP CONTENT]),
CALCULATE(LASTNONBLANK(FaceBook[Likes], MAX(FaceBook[ Date ]))))

LAST_FOLLOWERS = SUMX(SUMMARIZE(repository, repository[Page], repository[RESP CONTENT]),
CALCULATE(LASTNONBLANK(FaceBook[Followers], MAX(FaceBook[ Date ]))))
 
COMMUNITY =
VAR SUMROW = [LAST_LIKES] + [LAST_FOLLOWERS]
RETURN SUMROW / 2
 
The result is:
BeaBF_0-1646299389132.png
In your example the total per row of RESP2 is 40, but actually from the data you pasted it turns out to be 80, hence the different sums.
 
BF

View solution in original post

2 REPLIES 2
BeaBF
Super User
Super User

@SoufTC I try to write you my measures based on how I interpreted them:

 

LAST_LIKES = SUMX(SUMMARIZE(repository, repository[Page], repository[RESP CONTENT]),
CALCULATE(LASTNONBLANK(FaceBook[Likes], MAX(FaceBook[ Date ]))))

LAST_FOLLOWERS = SUMX(SUMMARIZE(repository, repository[Page], repository[RESP CONTENT]),
CALCULATE(LASTNONBLANK(FaceBook[Followers], MAX(FaceBook[ Date ]))))
 
COMMUNITY =
VAR SUMROW = [LAST_LIKES] + [LAST_FOLLOWERS]
RETURN SUMROW / 2
 
The result is:
BeaBF_0-1646299389132.png
In your example the total per row of RESP2 is 40, but actually from the data you pasted it turns out to be 80, hence the different sums.
 
BF
BeaBF
Super User
Super User

@SoufTC Hi!

Can you tell me what the "COMMUNITY" measure should do?

 

BF

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.