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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JoachimSA
Helper II
Helper II

Segment Project Dimension by gaps in time line

Dear all,

I am having trouble creating the column "SOP Cluster" in DAX:

2022-12-29 09_09_09-Window.png

 

 

So basically I want to segment each project into vrious clusters defined by GAPs in the SOP timeline. I would like to define the length of this GAP in month later. For now just at least one calendar year without SOPs.

The SOP Column is linked to a proper calendar table.

THe real Project table is huge and consists of many thousand Projects consisting of many more Vehicles.

I would like to solve this in DAX because I would like to be able to later extend the logic for segmentation.

For Example by defining a GAP as a year with "very low" volume ( based on some [volume] measures from the fact table.

 

Thanks an best regards,

Joachim

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @JoachimSA ,

 

To create the "SOP Cluster" column in DAX, you can use the following formula:

  • First, create a new calculated column in your Project table called "SOP Date Diff", which calculates the difference between the latest SOP date for each project and the earliest SOP date for each project, in months. You can use the DATEDIFF function to do this:
SOP Date Diff = DATEDIFF(Project[Earliest SOP Date], Project[Latest SOP Date], MONTH)
  • Next, create a new calculated column called "SOP Cluster", which assigns each project to a cluster based on the value in the "SOP Date Diff" column. You can use an IF statement to do this:
SOP Cluster =
IF(Project[SOP Date Diff] >= 12, "Cluster 1",
IF(Project[SOP Date Diff] >= 6, "Cluster 2",
IF(Project[SOP Date Diff] >= 3, "Cluster 3",
IF(Project[SOP Date Diff] >= 1, "Cluster 4",
"Cluster 5"))))

This formula assigns projects with a SOP date difference of at least 12 months to Cluster 1, projects with a SOP date difference of at least 6 months but less than 12 months to Cluster 2, and so on. You can adjust the criteria and number of clusters to fit your specific needs.

 

You can then use the SOP Cluster column as a visual filter or as a slicer in your Power BI report to segment the projects by SOP cluster.


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

1 REPLY 1
v-henryk-mstf
Community Support
Community Support

Hi @JoachimSA ,

 

To create the "SOP Cluster" column in DAX, you can use the following formula:

  • First, create a new calculated column in your Project table called "SOP Date Diff", which calculates the difference between the latest SOP date for each project and the earliest SOP date for each project, in months. You can use the DATEDIFF function to do this:
SOP Date Diff = DATEDIFF(Project[Earliest SOP Date], Project[Latest SOP Date], MONTH)
  • Next, create a new calculated column called "SOP Cluster", which assigns each project to a cluster based on the value in the "SOP Date Diff" column. You can use an IF statement to do this:
SOP Cluster =
IF(Project[SOP Date Diff] >= 12, "Cluster 1",
IF(Project[SOP Date Diff] >= 6, "Cluster 2",
IF(Project[SOP Date Diff] >= 3, "Cluster 3",
IF(Project[SOP Date Diff] >= 1, "Cluster 4",
"Cluster 5"))))

This formula assigns projects with a SOP date difference of at least 12 months to Cluster 1, projects with a SOP date difference of at least 6 months but less than 12 months to Cluster 2, and so on. You can adjust the criteria and number of clusters to fit your specific needs.

 

You can then use the SOP Cluster column as a visual filter or as a slicer in your Power BI report to segment the projects by SOP cluster.


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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