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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
eakeekkk
Frequent Visitor

Sum child under parent issue

Hi Folks,

 

My requirement is to sum all child value under slicer filter parrent id seperate by other column eg. sex, position. My DAX code is correct when show in card visual but when show in metrix visual with other columns. It show only  column value eg. Male with relate to filter's id. Could you have any suggestion?

DAX 

sum value = 

VAR CurrentEmployeeID = SELECTEDVALUE('Member'[ID])
RETURN
CALCULATE (
sum('Member'[Value]),
ALL( 'Member'[ID] ),
PATHCONTAINS ( 'Member'[Path], CurrentEmployeeID )
)
 
Output came out
SexSum Value
Male18
Total

126

 

Output that I Want

SexSum Value
Male18
Female108
Total126

 

Thank you,

5 REPLIES 5
eakeekkk
Frequent Visitor

Now I'm already finish this requirement by create another distinct ID table and use this table as a slicer.

 

Here is my measure

 

sum value = 

VAR CurrentEmployeeID = CALCULATE(SELECTEDVALUE('DimID'[ID]),ALLEXCEPT('DimID','DimID'[ID]))
RETURN
CALCULATE (
sum('Member'[Value]),
ALL'DimID'[ID] ),
PATHCONTAINS ( 'Member'[Path]CurrentEmployeeID )
)
eakeekkk
Frequent Visitor

Sorry to reply late already test this measure but it's return the same result don't have output for female

 

and in edit interaction regard to selectvalue for slicer and ignore interaction the output return blank 

 

Could you have other solution?

 

Thank you,

Hi @eakeekkk 

 

Your measure is comparing 'Member'[Path] with the current member's id. Is a member possible to have both Male data and Female data in the data table? Can you provide some fake data to show the table structure and the expected output based on that data?

 

Regards,

Jing

eakeekkk
Frequent Visitor

It seem matrix visual is filtered by filter's id of parrent is there anyway to disable filter in row or column of visual

Hi @eakeekkk 

 

Try this measure

sum value =
VAR CurrentEmployeeID =
    SELECTEDVALUE ( 'Member'[ID] )
RETURN
    CALCULATE (
        SUM ( 'Member'[Value] ),
        ALL ( 'Member'[ID], 'Member'[Path] ),
        PATHCONTAINS ( 'Member'[Path], CurrentEmployeeID )
    )

 

Or if you don't want the slicer to filter the matrix visual, you can select the slicer, go to Format > Edit interactions. Disable the slicer from filtering the matrix visual. Reference: Change how visuals interact in a Power BI report 

vjingzhang_0-1651025244279.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
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.