Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe 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.
Hello All,
I have2 tables like this,
I want to list the distinct count of ID, when its, Col-A = 1 and (corrosponding Col-B values in other table is not H),
Here in this example i want to count 103,104,106 and 104 and return 4 as value (rejecting 100, 101, 105 as 500 and 508 has value H )
Solved! Go to Solution.
Hi @NithinBN ,
I'd probably start with a calculated column in the first table:
ColLvlLookup = CALCULATE ( MAX(Table2[lvl]), FILTER ( Table2, Table1[col-B] = Table2[Col-B] ) )
And then you can add a measure:
Measure = VAR _helpTable = SUMMARIZE ( FILTER ( Table1, Table1[ColLvlLookup] = "H" ), Table1[ID] ) RETURN CALCULATE ( DISTINCTCOUNT ( Table1[ID] ), Table1[col-A] = 1, NOT Table1[ID] IN (_helpTable) )
You could also write the two code bits together in one measure as well:
Measure 2 = VAR _helpTable = SUMMARIZE ( FILTER ( Table1, CALCULATE ( MAX(Table2[lvl]), FILTER ( Table2, Table1[col-B] = Table2[Col-B] ) ) = "H" ), Table1[ID] ) RETURN CALCULATE ( DISTINCTCOUNT ( Table1[ID] ), Table1[col-A] = 1, NOT Table1[ID] IN (_helpTable) )
Hope this helps! 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! | |
#proudtobeasuperuser | |
Hi @NithinBN ,
I'd probably start with a calculated column in the first table:
ColLvlLookup = CALCULATE ( MAX(Table2[lvl]), FILTER ( Table2, Table1[col-B] = Table2[Col-B] ) )
And then you can add a measure:
Measure = VAR _helpTable = SUMMARIZE ( FILTER ( Table1, Table1[ColLvlLookup] = "H" ), Table1[ID] ) RETURN CALCULATE ( DISTINCTCOUNT ( Table1[ID] ), Table1[col-A] = 1, NOT Table1[ID] IN (_helpTable) )
You could also write the two code bits together in one measure as well:
Measure 2 = VAR _helpTable = SUMMARIZE ( FILTER ( Table1, CALCULATE ( MAX(Table2[lvl]), FILTER ( Table2, Table1[col-B] = Table2[Col-B] ) ) = "H" ), Table1[ID] ) RETURN CALCULATE ( DISTINCTCOUNT ( Table1[ID] ), Table1[col-A] = 1, NOT Table1[ID] IN (_helpTable) )
Hope this helps! 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! | |
#proudtobeasuperuser | |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
81 | |
53 | |
37 | |
37 |