Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The 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.

Reply
Anonymous
Not applicable

Have drillthrough for distinct count show one distinct row per category, not multiple rows?

Lets say I have a chart that looks like this:

 

ProjectRevisionForecast Finish
A03/2/2022
A13/2/2022
A23/2/2022
B05/1/2022
B15/1/2022
C011/30/2022
D012/15/2021
D112/15/2021
D212/15/2021
D312/15/2021
D412/15/2021
D512/15/2021

 

I want to create a bar chart that returns a distinct count of the unique project numbers in the Project Column that have been revised at least once. (the distinct count would be three--Project C has revision number 0, indicating it was never revised)


This is the DAX code I am currently using:

Distinct Count of Projects with at least one revision by Forecast Finish Date =
    CALCULATE(
        DISTINCTCOUNTNOBLANK('Projects'[Project])
        , 'Projects'[Revision] > 0
        , USERELATIONSHIP('Date'[Date], 'Projects'[Forecast Finish])
    )


The bar chart seems to be correct, but I can't figure out how to get the drill through the way I want it.

If the user wants to drill through and get project details for these revised orders, I don't want them to see every revision.  Right now when the user drills through into my bar chart, they see all of the revisions for the revised projects. I worry this will confuse users, and cause them to ask "Why is the distinct count 3 but the drill through has eight rows?":

ProjectRevisionForecast Finish
A13/2/2022
A23/2/2022
B15/1/2022
D112/15/2021
D212/15/2021
D312/15/2021
D412/15/2021
D512/15/2021


Instead I would like the drill through to show: 

ProjectRevisionForecast Finish
A23/2/2022
B15/1/2022
D512/15/2021

 

If I try removing the revision number and just having the Project number, it still has the same number of rows as the revisions that are greater than 0 like so:

ProjectForecast Finish
A3/2/2022
A3/2/2022
B5/1/2022
D12/15/2021
D12/15/2021
D12/15/2021
D12/15/2021
D12/15/2021


I'm familiar with getting to the highest order revision by writing somthing like this, but then I would lose USERELATIONSHIP(), right?

Count Projects by Highest Revision =
    COUNTX(
        VALUES('Projects'[Project])
        , [Highest Order Revision]
    )


([Highest Order Revision] would be MAX('Project'[Revision]). On an unrelated note, I've found that for some reason it only narrows down to the highest project revision per project if I reference the measure. If I write MAX('Project'[Revision]) instead of [Highest Order Revision], it seems to just return the highest order revision on the table of all the orders (so it returns 5, rather than creating a mini-table with 5 revisions on D, 0 revisions on C, 1 revision on B, and 2 revisions on A... Unrelated to my main problem however.)

What do you recommend?

2 REPLIES 2
lbendlin
Super User
Super User

Create a measure that identifies the highest revision for the current filter context.  Add that measure as a visual filter.

Anonymous
Not applicable

Hmm, so I do have a measure Highest Order Revision = MAX('Project'[Revision]). I also am aware that I could add the 'Project'Revision field to the drillthrough page and select the "Max" aggregation. However, using either one of these options results in a blank in that field. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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