cancel
Showing results for
Did you mean:
Member

## Measure that calculates each row based on slicer

Two tables: Date Table and Fact Table

Date table is connected to the Fact Table based on Project Start Date.

The Fact Table also has Project End Date as well.

Have a slicer that is based on Project Start Date.

To get the Number of Project Days, I can calculate the difference between Project Start and End Date but since we have slicer based on start date I will have to factor that in as well.

Example:
Slicer has date range 1/1/2017 and 3/1/2017.
3 Project that start dates fall between these dates.
Project A start date is 2/1/2017 and end date is 2/5/2017. Project B Start Date is 1/1/2017 and  ends of 3/20/2017.
Project C starts on 12/1/2016 and ends on 1/30/2017.
So the sum of days that fall between the slicer date range is 92:
Project A = 4  (2/4 - 2/1)
Project B = 59 (3/1 - 1/1)
Project C = 29  (1/30 - 1/1)

If there a way to get the 92 dynamically through a measure?

4 REPLIES 4
Super User

## Re: Measure that calculates each row based on slicer

@acbg what is the structure of your fact table? Do you have start and end date on same row, and if projected is not completed I guess in that case end date is blank, correct?

if that is the case, you can add another field called "projectdays" and use that to get total number of days it took to complete the project.

Proud to be a Datanaut! Kudos Help
Connect with me on Linkedin. Feel free to email me with any of your BI needs.

Member

## Re: Measure that calculates each row based on slicer

@parry2k  Project End date is in different column.

I am trying to get the total project days that falls between the slicer dates.

If the project days is 365 but the slicer selection is only for 2 months and the project falls between the slicer range then the measure should show 60 days. If the project has only one month that overlaps with the slicer then the project days would be 30days for that project.

Super User

## Re: Measure that calculates each row based on slicer

@acbg can you share sample data and how your table is structured?

Is it something like

ProjectId        Start Date         End Date

1                    Jan 1 2019         Jan 30 2019

2                    Feb 2 2019

3                    Jan 1 2018        Jan 30 2019

So in above sample , project 2nd is not completed and other two are completed

Proud to be a Datanaut! Kudos Help
Connect with me on Linkedin. Feel free to email me with any of your BI needs.

Highlighted
Member

## Re: Measure that calculates each row based on slicer

@parry2k  Yes that is how the table structured.

I have a way to do this in Power Query but would like something more dynamic through the measure.