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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
sushdutta
New Member

Data drill down a table

Hi All,

 

Kindly could you provide some guidance how i can solve this scenario 

I have a table of say four columns. 

Acc  Customer Security Expiry

1        123           ABC     24/12/2024

2         321          CBA     25/12/2021

3         142          ADB     21/03/2020

4          321         BCA      21/04/2026

4          333         BCA      21/04/2026

5          333         ACD       21/04/2026   etc. 

 

I am looking for a query to identify all accounts by customer 321 and if joint ownership then to also fetch all account of joint owners. Is there a way i can do it in DAX?

 

Thanks and Regards

SD

 

1 ACCEPTED SOLUTION
v-zhengdxu-msft
Community Support
Community Support

Hi @sushdutta 

 

Please try this:

Table:

vzhengdxumsft_0-1727144859604.png

First of all, create a calculated table:

Table 2 = SUMMARIZE('Table','Table'[Acc],'Table'[Customer])

vzhengdxumsft_1-1727145420736.png

Create a Slicer with 'Table2'[Customer]:

vzhengdxumsft_2-1727145499949.png

Then add a measure:

MEASURE =
VAR _vtable =
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN ( 'Table 2', ALLSELECTED ( 'Table' ) ),
            'Table 2'[Acc] = 'Table'[Acc]
        ),
        'Table'[Customer]
    )
RETURN
    IF ( MAX ( 'Table'[Customer] ) IN _vtable, 1 )

The result is as follow:

vzhengdxumsft_3-1727145536183.png

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

(Virus scan in progress ...)
2 REPLIES 2
v-zhengdxu-msft
Community Support
Community Support

Hi @sushdutta 

 

Please try this:

Table:

vzhengdxumsft_0-1727144859604.png

First of all, create a calculated table:

Table 2 = SUMMARIZE('Table','Table'[Acc],'Table'[Customer])

vzhengdxumsft_1-1727145420736.png

Create a Slicer with 'Table2'[Customer]:

vzhengdxumsft_2-1727145499949.png

Then add a measure:

MEASURE =
VAR _vtable =
    SELECTCOLUMNS (
        FILTER (
            CROSSJOIN ( 'Table 2', ALLSELECTED ( 'Table' ) ),
            'Table 2'[Acc] = 'Table'[Acc]
        ),
        'Table'[Customer]
    )
RETURN
    IF ( MAX ( 'Table'[Customer] ) IN _vtable, 1 )

The result is as follow:

vzhengdxumsft_3-1727145536183.png

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

(Virus scan in progress ...)
ahadkarimi
Solution Specialist
Solution Specialist

Hi @sushdutta, give this a try, and if you encounter any issues, let me know. change YourTableName to your table name.

AllRelevantAccounts = 
VAR TargetCustomer = 321

VAR TargetCustomerAccounts =
    CALCULATETABLE(
        VALUES('YourTableName'[Acc]),
        'YourTableName'[Customer] = TargetCustomer
    )

VAR JointOwners =
    CALCULATETABLE(
        DISTINCT('YourTableName'[Customer]),
        'YourTableName'[Acc] IN TargetCustomerAccounts,
        'YourTableName'[Customer] <> TargetCustomer
    )

VAR AllCustomers =
    UNION(
        {TargetCustomer},
        JointOwners
    )

RETURN
    FILTER(
        'YourTableName',
        'YourTableName'[Customer] IN AllCustomers
    )

 

Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Specialist!

Helpful resources

Announcements