Forum Discussion

harshadrokade's avatar
harshadrokade
Post Partisan
4 years ago
Solved

DAX filter help needed

Hi,

 

I have table as Vendordata (See at bottom). There is other table which has Vendor names as well (Vendorlist) & a slicer is created based on Vendor name from Vendorlist table. Vendordata & Vendorlist tables are connected with each other with Vendor name only.

 

I have created a card visual & I want to see how many clients using selected vendor in slicer as Secondary vendor. 

E.g. If I select ABC4 in the slicer, I want the card visual to show count as 4 becasue there are 4 clients using it as Secondary vendor. If I select ABC6 in the slicer, I want the card visual to show count as 3.

 

I have created a dax but since two tabes connected with Vendor name only & I have slicer as Vendor name, it is filtering the table & showing count as blank. Pls help sir.

 

MS-original1 = if (ISFILTERED ('Vendirlist'[Vendor name]),CALCULATE(COUNT('Vendordata'[Secondary Vendor]),ALLEXCEPT('Vendordata','Vendordata'[Secondary Vendor]),'Vendordata'[Secondary Vendor]=SELECTEDVALUE('Vendorlist'[Vendir name])),"NA")

 

Table Vendordata-

Client IDVendorSecondary VendorServiceService used?
1ABC1ABC4XYZ1Yes
2ABC1ABC4XYZ1Yes
3ABC1ABC4XYZ1Yes
4ABC1ABC4XYZ2Yes
5ABC4ABC5XYZ2Yes
6ABC4ABC5XYZ3Yes
7ABC5ABC6XYZ3 Yes
8ABC2ABC6XYZ3No
9ABC7ABC6XYZ3No

 

  • Does this work?

     

    MS-original1 =
    VAR SelectedVendor = SELECTEDVALUE ( 'Vendorlist'[Vendor name] )
    RETURN
        CALCULATE (
            COUNT ( 'Vendordata'[Secondary Vendor] ),
            ALL ( 'Vendorlist' ),
            'Vendordata'[Secondary Vendor] = SelectedVendor
        )

4 Replies

  • Does this work?

     

    MS-original1 =
    VAR SelectedVendor = SELECTEDVALUE ( 'Vendorlist'[Vendor name] )
    RETURN
        CALCULATE (
            COUNT ( 'Vendordata'[Secondary Vendor] ),
            ALL ( 'Vendorlist' ),
            'Vendordata'[Secondary Vendor] = SelectedVendor
        )