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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
barakm
Frequent Visitor

last date not shown correctly

Hello Dear Team,

Got an issue with displaying the last date

I have a table with startTime endTime and WeekRange 

startTime        endTime
2024-07-02    2024-07-09
2024-07-09    2024-07-16
2024-07-16    2024-07-23
2024-07-23    2024-07-30
2024-07-30    2024-08-06
2024-08-06    2024-08-13

and I have added new column named WeekRange to show a Week Range in this format:
06-08-2024 to 13-08-2024
02-07-2024 to 09-07-2024
30-07-2024 to 06-08-2024

WeekRange =
FORMAT([startTime].[Date], "DD-MM-YYYY") & " to " & FORMAT([endTime].[Date], "DD-MM-YYYY")

 

 

Now I want to show in a Card visual only the last week range,
On visualizations, when selecting in the Fields Last WeekRange it shows the 30-07-2024 to 06-08-2024 but not the correct one   06-08-2024 to 13-08-2024

Do you know how do I fix this ? 

 

 

1 ACCEPTED SOLUTION
qqqqqwwwweeerrr
Super User
Super User

Max Range =
VAR MaxStartDate =
    MAXX(ALL('Table'), 'Table'[startTime])
VAR MaxEndDate =
    MAXX(
        FILTER(
            ALL('Table'),
            'Table'[startTime] = MaxStartDate
        ),
        'Table'[endTime]
    )
VAR RangeValue =
    CALCULATE(
        VALUES('Table'[week_range]),
        'Table'[startTime] = MaxStartDate &&
        'Table'[endTime] = MaxEndDate
    )
RETURN
    IF(
        ISBLANK(RangeValue),
        BLANK(),
        RangeValue
    )
 
qqqqqwwwweeerrr_0-1723561163885.png

I am getting this can you please check, if this works

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

View solution in original post

3 REPLIES 3
barakm
Frequent Visitor

My bad, it works , thanks a lot

qqqqqwwwweeerrr
Super User
Super User

Max Range =
VAR MaxStartDate =
    MAXX(ALL('Table'), 'Table'[startTime])
VAR MaxEndDate =
    MAXX(
        FILTER(
            ALL('Table'),
            'Table'[startTime] = MaxStartDate
        ),
        'Table'[endTime]
    )
VAR RangeValue =
    CALCULATE(
        VALUES('Table'[week_range]),
        'Table'[startTime] = MaxStartDate &&
        'Table'[endTime] = MaxEndDate
    )
RETURN
    IF(
        ISBLANK(RangeValue),
        BLANK(),
        RangeValue
    )
 
qqqqqwwwweeerrr_0-1723561163885.png

I am getting this can you please check, if this works

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

barakm_0-1723562166433.png

 

Thanks you for the try , I'm getting the following error in the visual when loading your DAX code 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.