cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
SPa
Frequent Visitor

How to ignore columns in table visual when summing values across dataset.

I have two table with the following relevant fields:

 

- CS

* Name

* Related Case

 

- SC

* Child Case Ref

 

An example table would be

 

Name  Related Case  Child Case Ref

Sean    Case1             Case1a

Sean    Case 2            Case2a

Sean    Case 3            Case3a

David   Case 4            Case4a

 

What I want is to add a column that would show the number of distinct 'Related Case' values per name.

 

So for Sean that would be 3 and david 1.

 

Name Related Case  Child Case Ref   NEW COLUMN

Sean    Case1             Case1a              3

Sean    Case 2            Case2a              3

Sean    Case 3            Case3a              3

David   Case 4            Case4a              1

 

How can I do this?

1 ACCEPTED SOLUTION

Hi @SPa 

 

Thanks for the reply from @Greg_Deckler and @bhanu_gautam .

 

@SPa , you can try the following measure.

 

Measure = COUNTX(FILTER(ALL('Table'), [Name] = MAX([Name])), [Related Case])

 

Output:

vxuxinyimsft_0-1720505255120.png

 

Best Regards,
Yulia 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

6 REPLIES 6
bhanu_gautam
Super User
Super User

You can see in attached PBIX file that it is giving correct answer 

 

bhanu_gautam_0-1719929592514.png

 

Just replace column and table name 

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!





Ah ok, thank you for explaining. My issue is that I have a directquery connection to the data. Therefore a new column with calculate is not possible. 

Hi @SPa 

 

Thanks for the reply from @Greg_Deckler and @bhanu_gautam .

 

@SPa , you can try the following measure.

 

Measure = COUNTX(FILTER(ALL('Table'), [Name] = MAX([Name])), [Related Case])

 

Output:

vxuxinyimsft_0-1720505255120.png

 

Best Regards,
Yulia Xu

 

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

bhanu_gautam
Super User
Super User

@SPa, You can achieve this using DAX and since you have not mentioned relation between table 1 and 2 , I have not considered it and it won't impact the outcome

 

Please find the attached PBIX

 

DAXDistinctRelatedCasesCount =
CALCULATE(
    DISTINCTCOUNT('CS'[Related Case]),
    ALLEXCEPT('CS', 'CS'[Name])
)



Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!





When I try this, I get the following result:

Name Related Case  Child Case Ref   NEW COLUMN

Sean    Case1             Case1a              1

Sean    Case 2            Case2a              1

Sean    Case 3            Case3a              1

David   Case 4            Case4a              1

Greg_Deckler
Super User
Super User

@SPa Try:

Measure = 
  VAR __Name = MAX( 'Table'[Name] )
  VAR __Table = FILTER( ALL( 'Table' ), [Name] = __Name )
  VAR __Result = COUNTROWS( 'Table' )
RETURN
  __Result

Vote for my sticker!

Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Sticker Challenge

Join our Community Sticker Challenge

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.