Forum Discussion
Dax function RELATED - How Do I Apply It?
- 1 year ago
After doing some due diligence (reading and learning) about Row Context, Filter Context, Calculate, thanks to videos frm SQLBI, I think I have a better grasp of how the slicers and visuals work.
I think I fixed the problem without writing any DAX.
I simply added a filter to the entire page for User[Id] is not Blank. That filtered my table visual and the card visual. This works because the goal is to demonstrate how many applications were approved for the selected date, but only those approved by a User from the User table. There will never be a business reason to include those that are approved by any entity outside of the User table.
My thanks & my apologies to DataNinja777 . It appears I messed up my OP. The original measure to count the rows in the table visual was this:
Total NA Apps Approved = COUNTROWS( SUMMARIZE( FILTER('NA Apps', [Approved]), 'NA Apps'[Id] ) )I failed to communicate that I needed a count of all approved apps by users only. Not counts of how many apps approved by individual users.
But that would be a good slicer to add for management overview.
Thank you for your response.
Oh thank you so much for explaining that RELATED is for calculated columns.
However, the visual is not grouped or filtered by User[Id] so I am not sure how to apply the measure you provided. If I remove the original measure I created (see op), and replace it with the one you gave me, the table visual goes blank. The only way to get it to display data is to add a column from Users. Which I suppose is okay, but it not necessary to display it. I tried clicking the hide icon in filters, but it does not disappear in the visual. (I am very new to Power Bi.)
Next problem: How to fix the card visual that counts the number of rows in the table visual on the same page? In other words, how do I incorporate the User ID filter? Here is the original measure for the card visual:
Total NA Apps Approved = COUNTROWS(
SUMMARIZE(
FILTER('NA Apps',
[Approved]),'NA Apps'[Id]
))I tried adding the new mesure to it in the Filter argument but it displays blank. If I am understanding correctly, it returns a blank because the NA Apps table does not have a relationship with the Users table? It is related to the HX table in a 1 to many relationship.
Total NA Apps Approved = COUNTROWS(
SUMMARIZE(
FILTER('NA Apps',
[Licensing NA Approved Apps]),'NA Apps'[Id]
))
Here are the relationships:
Thank you in advance.
After doing some due diligence (reading and learning) about Row Context, Filter Context, Calculate, thanks to videos frm SQLBI, I think I have a better grasp of how the slicers and visuals work.
I think I fixed the problem without writing any DAX.
I simply added a filter to the entire page for User[Id] is not Blank. That filtered my table visual and the card visual. This works because the goal is to demonstrate how many applications were approved for the selected date, but only those approved by a User from the User table. There will never be a business reason to include those that are approved by any entity outside of the User table.
My thanks & my apologies to DataNinja777 . It appears I messed up my OP. The original measure to count the rows in the table visual was this:
Total NA Apps Approved =
COUNTROWS(
SUMMARIZE(
FILTER('NA Apps',
[Approved]),
'NA Apps'[Id]
)
)
I failed to communicate that I needed a count of all approved apps by users only. Not counts of how many apps approved by individual users.
But that would be a good slicer to add for management overview.
Thank you for your response.