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

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.

Reply
arnomics
Helper I
Helper I

Use previous Row Date & Current Row Date to create range for calculation

Hi all,

 

I've been trying to crack this specific requirement.

 

I currently have a Table Visual with Date from Date Column. I've got the below Measure which concatenates Payment info from Payment Table.

 

The result returned with the existing Measure are good. It returns Concatenated values based on the Month Name.

However, I'm now trying to create/use a Range that will help me create a Date Range based on Dates displayed on the visual.

 

i.e instead of using Month Name, I want to use the Date in Current Row & Date in Previous/Earlier row to create a Date Range to concatenate values that fall within the Date Range.

 

Is this something that can be achieved? Or am I trying something that is not possible. Thanks.

VAR SelectedMonths = VALUES('Date'[Month Name])
RETURN
    CALCULATE (
        CONCATENATEX (
            '06 Payment', 
            '06 Payment'[PayDATE] & " $" & '06 Payment'[PaymentAmt],
            ",|  "
        ),
        'Date'[Month Name] IN SelectedMonths, 
        ALLEXCEPT('Date', 'Date'[Month End Date])
    )

 

1 ACCEPTED SOLUTION
miTutorials
Super User
Super User

Please try the offset function. It is explained in the below tutorial. watch from 2:18

 

New Dax Functions in PowerBI | Index, Offset & Window | MiTutorials - YouTube

View solution in original post

2 REPLIES 2
miTutorials
Super User
Super User

Please try the offset function. It is explained in the below tutorial. watch from 2:18

 

New Dax Functions in PowerBI | Index, Offset & Window | MiTutorials - YouTube

Thanks heaps . That worked like a charm.This was my Measure Offset Measure = CALCULATE([TSET], OFFSET(-1,ALLSELECTED(Date'[Date])))However, I have a question. Below is the Offset Measure on a Visual.  Why is the first row for 2023 blank? Ideally, we would expect to see 5/12/2022 12:00:00 AM. Any ideas? Thanks again!

2023-11-07 21_21_08.png

@miTutorials

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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