cancel
Showing results for
Did you mean:
Regular Visitor

## DAX Datesbetween Date and Last 10 weeks, Count STATUS="green"

Hi everybody, i need your help with dax:

i have a one year data with weekly Analysis Date. So it's a historical data weekly backed up. Each analysis date is the first day of the week.

-i need to count how many persons with Status="green" were there in the last 10 weeks in each Analysis Date.

so today: go back of 10 weeks and count how many persons had Status="ok" in the period today and minus 10 weeks

17 of june: go back of 10 weeks and count how many persons had Status="ok" in the period 17 june and minus 10 weeks

i want to have this information per each analysis date. So not exactly 10 weeks ago, but in all the Analysis Dates between 10 weeks ago and the Analysis date

Any suggestion ?

Columns:
ANALYSIS DATE(each monday of the week;, PERSON(id of person);  STATUS(red, green,amber)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Moderator

## Re: DAX Datesbetween Date and Last 10 weeks, Count STATUS="green"

@Giavo,

Create a new table using dax below.

Table = CALCULATETABLE(YourTable,YourTable[STATUS]="green")

Then in the new table, create the following column and measure.

Column  = DATE(YEAR('Table'[ANALYSIS DATE]),MONTH('Table'[ANALYSIS DATE]),DAY('Table'[ANALYSIS DATE])-70)

Measure  = CALCULATE(COUNTA('Table'[PERSON]),DATESBETWEEN('Table'[ANALYSIS DATE],MAX('Table'[Column]),MAX('Table'[ANALYSIS DATE])))

At last, create a table visual using date field and measure of the new table.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Moderator

## Re: DAX Datesbetween Date and Last 10 weeks, Count STATUS="green"

@Giavo,

Create a new table using dax below.

Table = CALCULATETABLE(YourTable,YourTable[STATUS]="green")

Then in the new table, create the following column and measure.

Column  = DATE(YEAR('Table'[ANALYSIS DATE]),MONTH('Table'[ANALYSIS DATE]),DAY('Table'[ANALYSIS DATE])-70)

Measure  = CALCULATE(COUNTA('Table'[PERSON]),DATESBETWEEN('Table'[ANALYSIS DATE],MAX('Table'[Column]),MAX('Table'[ANALYSIS DATE])))

At last, create a table visual using date field and measure of the new table.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.