cancel
Showing results for
Did you mean:
Highlighted
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
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.
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.

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 113 members 1,557 guests
Recent signins: