Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Zakaria_1980
Post Patron
Post Patron

Need Help please

Hi,

I have such DB for which I need to see Tbl in Power BI, where he will keep me only 1 entry per project taking into account this control:

Check for each project is Start date is the same, should check the end date and keep for me the latest date and delete other rows for that project

if the start date is not the same, he will keep for me the latest date and delete other rows related to that project.

 

I appreciate if you could send me the PBI report so it will be easy for me to understand.

 

 

 

ProjectStart DateEnd date
A21/12/202118/01/2022
B16/10/202217/10/2022
C23/02/202222/04/2022
C23/02/202205/06/2022
C23/02/202225/08/2022
D21/12/201906/07/2022
K09/03/202002/02/2022
F22/06/202103/07/2022
Z15/11/202119/01/2022
Z15/04/202220/06/2022
W08/06/202102/02/2022
J08/04/202018/03/2022
X12/04/202220/04/2022
X29/06/202229/06/2022
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new table.

 

Jihwan_Kim_0-1675137374915.png

New table = 
VAR _groupbymaxenddate =
    GROUPBY (
        Data,
        Data[Project],
        Data[Start Date],
        "@newenddate", MAXX ( CURRENTGROUP (), Data[End date] )
    )
VAR _maxstartdate =
    GROUPBY (
        _groupbymaxenddate,
        Data[Project],
        "@newstartdate", MAXX ( CURRENTGROUP (), Data[Start Date] )
    )
RETURN
    ADDCOLUMNS (
        _maxstartdate,
        "@enddate",
            MAXX (
                FILTER (
                    _groupbymaxenddate,
                    Data[Project] = EARLIER ( Data[Project] )
                        && Data[Start Date] = EARLIER ( [@newstartdate] )
                ),
                [@newenddate]
            )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

3 REPLIES 3
Zakaria_1980
Post Patron
Post Patron

Yes that's the output i want.

Thanks

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new table.

 

Jihwan_Kim_0-1675137374915.png

New table = 
VAR _groupbymaxenddate =
    GROUPBY (
        Data,
        Data[Project],
        Data[Start Date],
        "@newenddate", MAXX ( CURRENTGROUP (), Data[End date] )
    )
VAR _maxstartdate =
    GROUPBY (
        _groupbymaxenddate,
        Data[Project],
        "@newstartdate", MAXX ( CURRENTGROUP (), Data[Start Date] )
    )
RETURN
    ADDCOLUMNS (
        _maxstartdate,
        "@enddate",
            MAXX (
                FILTER (
                    _groupbymaxenddate,
                    Data[Project] = EARLIER ( Data[Project] )
                        && Data[Start Date] = EARLIER ( [@newstartdate] )
                ),
                [@newenddate]
            )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Ashish_Mathur
Super User
Super User

Hi,

Clearly show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors