cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

## DAX - Formula contain start and end dates.

Hello, everyone, I need your help.
I have a data matrix with two columns where they contain start and end dates.
I needed to know when we select a date this said it is within the time interval.

An example in the image.

I have already tried to use the dax if function .. but it doesn't work

Thank you

Status: Delivered

Hi @henrydhs ,

I wrote the ID attribute as a measure for the number of people. You can check the result below:

Also,you can turn off aggregation via the Totals attribute:

Measure = CALCULATE(SUMX('Table',[Measure ID]),FILTER('Table','Table'[range]="within range"))

Best regards,
Community Support Team_ Scott Chang

Community Support
Status changed to: Investigating

Hi @henrydhs ,

Based on your description, I did simple samples to get the following results:

Table 2 = CALENDAR(MIN('Table'[StartTime]),MAX('Table'[EndTime]))

range = IF(AND(SELECTEDVALUE('Table 2'[Date])>=MAX('Table'[StartTime]),SELECTEDVALUE('Table 2'[Date])<=MAX('Table'[EndTime])),"within range","")

Best regards,
Community Support Team_ Scott Chang

Frequent Visitor

Hello, Thank you for your help
but I have a problem. I want to convert the table to data format but I can't
it gives the following error

Frequent Visitor

Hello, again I managed to make the formula.
But now it only shows data if I select the day.
I wanted to choose a date range if the attribute is valid.
Example: Check if there is something within the range.

Community Support
Status changed to: Delivered

Hi @henrydhs ,

Try using the following expression:

range = IF(MAX('Table'[StartTime]) <=MAX('Table 2'[Date]) && MAX('Table'[EndTime]) >= MIN('Table 2'[Date]),"within range","")

Best regards,
Community Support Team_ Scott Chang

Frequent Visitor

Thank you. IT´s working Now.

Now a i have other questions

- How do I remove the final part of the table "Baixa"?
- How do I count the number of people? Since it is a measure, I can't use the count formula.

I needed that when selecting a time period, it would count the number of people to calculate the number of people on "baixa".

Community Support
Status changed to: Delivered

Hi @henrydhs ,

I wrote the ID attribute as a measure for the number of people. You can check the result below:

Also,you can turn off aggregation via the Totals attribute:

Measure = CALCULATE(SUMX('Table',[Measure ID]),FILTER('Table','Table'[range]="within range"))

Best regards,
Community Support Team_ Scott Chang

Frequent Visitor

Hello , I use de countax

Thank you

Completed Ideas

Idea Statuses