Forum Discussion

MyWeeLola's avatar
MyWeeLola
Icon for Helper II rankHelper II
2 years ago
Solved

How can I display 0 count values on a table filtered with values from another table?

Good afternoon

 

I have 2 tables.

TblRef
A
B
C
D

 

and

 

tblmain
A
B
C
D
E
F
G
H
A
B
B
C
C

 

I want to dsiplay a table which filters tblMain to teh values in tblRef, and displays 0 values.

 

In the examples above I want the display table output to look as below.

 

ValueCount
A2
B3
C3
D0

How do I achieve this?

 

I cannot seem to get the filter correct and when I use a measure to count, I tried adding +0 to the end which then gave me the non tblref values.

 

I look forward to hearing from you.

 

Lola

  • Hi MyWeeLola - if a value from tblRef does not exist in tblMain, it still shows a count of 0. but D is present in main table so we are gtting 1 . 

     

    Count for tblRef =
    VAR refValues = SELECTEDVALUE(Tblref[TblRef])
    RETURN
        CALCULATE(
            COUNTROWS(tblMain),
            Tblmain[tblmain] = refValues
        )
     
     

     

     

     

    Hope it helps

     

  • Hello MyWeeLola,

    Make relationship your table one to many. İf TblRef have unique values.

     

    After that You use below the dax code and for example my column name is "Text" but ı take the column from dimension table which means unique column table.


    However, you can't use the masure in slicer. So that I recommend to use the measure as filter pane.

     

    Kind Regards,
    Gökberk Uzuntaş

    📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!

    🔗 Stay Connected:
    📘 Medium |
    📺 YouTube |
    💼 LinkedIn |
    📷 Instagram |
    🐦 X |
    👽 Reddit |
    🌐 Website |
    🎵 TikTok |



4 Replies

  • Hi MyWeeLola - if a value from tblRef does not exist in tblMain, it still shows a count of 0. but D is present in main table so we are gtting 1 . 

     

    Count for tblRef =
    VAR refValues = SELECTEDVALUE(Tblref[TblRef])
    RETURN
        CALCULATE(
            COUNTROWS(tblMain),
            Tblmain[tblmain] = refValues
        )
     
     

     

     

     

    Hope it helps

     

  • Hello MyWeeLola,

    Make relationship your table one to many. İf TblRef have unique values.

     

    After that You use below the dax code and for example my column name is "Text" but ı take the column from dimension table which means unique column table.


    However, you can't use the masure in slicer. So that I recommend to use the measure as filter pane.

     

    Kind Regards,
    Gökberk Uzuntaş

    📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!

    🔗 Stay Connected:
    📘 Medium |
    📺 YouTube |
    💼 LinkedIn |
    📷 Instagram |
    🐦 X |
    👽 Reddit |
    🌐 Website |
    🎵 TikTok |