Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
2 |