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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
malikara46
Frequent Visitor

Get amount based on data in 3 different columns

Hello everyone, 

 

we have a project table where for each project we save the date of a milestone that has been passed. Milestone 1 must be passed first, than milestone 2 and than milestone 3. If a project passed all 3 milestones, all 3 columns will contain a date (see Project YXZ below)  

 

Project NameMilestone 1  Milestone 2  Milestone 3
ABC05.10.2020  
YXZ04.04.201904.12.202013.11.2021
GHL05.10.2020  
REW   

 

For each milestone we want to show the amount of projects that passed this milestone and the project name(s).

So the desired results looks like this: 

 

Milestone  Number of Projects  Project Names
Milestone 1      2

ABC

GHL

Milestone 2      0 
Milestone 3      1YXZ

 

The challenge where I am struggling is that we want distinct counts. So each project should be counted and displayed only once. If for example a project has reached all three milestones, it should not be counted in each milestone, but only in Milestone 3. 

This rule always applies so a different scenario is when a project has reached milestone 2, it should not be displayed or counted in milestone 1 but only in milestone 2. 

 

If a project has not passed any milestones it should not be counted or displayed on the table. 

 

Really appreciating any help or hint. 

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Please try to unpivot  these Milestone columns.

Vlianlmsft_0-1637647176858.png

 

Create a new column to determine the last milestone experienced by the project.

End_of_Milestone = 
var max_date = CALCULATE(MAX('Table (2)'[Date]),ALLEXCEPT('Table (2)','Table (2)'[Project Name]))
return IF('Table (2)'[Date]=max_date,'Table (2)'[Milestone])

Vlianlmsft_1-1637647212799.png

Finally, create two measures to get the results you expect:

NUmber_P = COUNT('Table (2)'[End_of_Milestone])+0
Measure 2 = CONCATENATEX (
            FILTER('Table (2)',NOT(ISBLANK('Table (2)'[End_of_Milestone]))),
            'Table (2)'[Project Name],
            ", ",             
            'Table (2)'[Project Name],   
            ASC               
        )

Vlianlmsft_3-1637647302393.png

 

 

View solution in original post

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Please try to unpivot  these Milestone columns.

Vlianlmsft_0-1637647176858.png

 

Create a new column to determine the last milestone experienced by the project.

End_of_Milestone = 
var max_date = CALCULATE(MAX('Table (2)'[Date]),ALLEXCEPT('Table (2)','Table (2)'[Project Name]))
return IF('Table (2)'[Date]=max_date,'Table (2)'[Milestone])

Vlianlmsft_1-1637647212799.png

Finally, create two measures to get the results you expect:

NUmber_P = COUNT('Table (2)'[End_of_Milestone])+0
Measure 2 = CONCATENATEX (
            FILTER('Table (2)',NOT(ISBLANK('Table (2)'[End_of_Milestone]))),
            'Table (2)'[Project Name],
            ", ",             
            'Table (2)'[Project Name],   
            ASC               
        )

Vlianlmsft_3-1637647302393.png

 

 

HotChilli
Super User
Super User

If you stick with the original table format, you could add a column which checks each column for blank (depending on the status hierarchy e.g.:

IF (NOT ISBLANK(TablePOrig[Milestone 3]), "Milestone3",....then milestone2 and so on

---

You could also Unpivot the data and add a marker column to indicate the latest status. 

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.