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.
HI Guys,
after some DAX help in solving a problem I have.
Basically its a table of dates and results and targets.
I need to get the maximum consecutive days that Targets have been met in the selected date range.
So looking at the data below.
With the entire set selected (22/5 - 10/6 ) it would be 5 days in a row that they have met targets of 0.75 (Or 75%) and above.
If the date range is altered to be from the 30/5 to 10/6 then it would just 3
and just possibly just 1 if it was from 06/06 to 8/06.
I know this is a island and gaps type problem and can solve it in SQL, but in DAX it has really stumped me, even after looking at other examples in the community pages re consecutive days.
The 'Result' column is a measure from a calculate but I've put in example below to simplify what Im trying to do.
As you can imagine this is very valuable information to the end user when they work with large date ranges of a year or so.
Also, Im using Direct query.
Any help welcomed.
Mike.
Date | Result | Met Target 0.75 and above | Target Run |
22/05/2020 | 0.7 | N | 0 |
23/05/2020 | 0.72 | N | 0 |
24/05/2020 | 0.71 | N | 0 |
25/05/2020 | 0.78 | Y | 1 |
26/05/2020 | 0.79 | Y | 2 |
27/05/2020 | 0.81 | Y | 3 |
28/05/2020 | 0.77 | Y | 4 |
29/05/2020 | 0.76 | Y | 5 |
30/05/2020 | 0.71 | N | 0 |
1/06/2020 | 0.72 | N | 0 |
2/06/2020 | 0.71 | N | 0 |
3/06/2020 | 0.76 | Y | 1 |
4/06/2020 | 0.76 | Y | 2 |
5/06/2020 | 0.77 | Y | 3 |
6/06/2020 | 0.71 | N | 0 |
7/06/2020 | 0.72 | N | 0 |
8/06/2020 | 0.75 | Y | 1 |
9/06/2020 | 0.76 | Y | 2 |
10/06/2020 | 0.74 | N | 0 |
@Anonymous , refer if this can help
Hi Ya,
thanks so much for the lead,
had a good look at their solution but that work for me as Im in Direct Query mode and 'calculate' isnt allowed in calculated columns so cannot even create the first column. Ended up putting the index into a SQL view to try and work that problem , but no luck.
Still looking at community pages for other solutions.
Mike.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
20 | |
3 | |
2 | |
2 | |
2 |