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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
shashiPaul1570
Frequent Visitor

DAX related

Hi Community,
I am trying to calculate the previously paid indeminity for my claims no. where claim type is 2 and transaction date is less than the selected date. 

tryPreviously Paid Indeminity =



Measure =
VAR X=FIRSTDATE('Date table'[Date])*1
VAR Y=CALCULATE(SUM('CP-CPBinder'[Amount Excl_ VAT2]),'CP-CPBinder'[cp-date(int)]<X)

RETURN Y
I have tried it with 
Amount Excl_ VAT2 =
CALCULATE(
SUM(CP-CPBinder'[Amount Excl_ VAT2]),
CP-CPBinder'[CP Type] = 2,
CP-CPBinder'[Transaction Date] < SELECTEDVALUE('Date Table'[Date])
)
it is giving me blank only.  What I need is the amount that have been paid prior to the selected date for any claim no. 

Regards
Shashi Paul 
1 ACCEPTED SOLUTION

@shashiPaul1570 

Please check the attached PBIX and let me know if you need any changes.

 

 

View solution in original post

5 REPLIES 5
NaveenGandhi
Super User
Super User

Hello @shashiPaul1570 

Can you provide sample data and desired output to understand the problem better?

Thanks,
Naveen

Please find the sample data. 

No_Transaction DateTypeAmount
10061010/11/202120
10131110/11/202110
10131210/11/2021278.29
10131310/11/20212260.98
10131410/11/202110
10131510/11/202120
10131610/11/202110
10131710/11/202110
10131810/11/202110
10131910/11/202120
10132013/12/2021178.29
10132113/12/20211260.98
10132213/12/20211182.68
10132310/11/202110
10132410/11/202100
10132510/11/202100
10132610/11/202100
10132710/11/202120
10132810/11/202120
10132910/11/202120
10173010/11/202120
10173110/11/202120
10193210/11/202120
10213310/11/202120
10213410/11/202120
10213510/11/202100
10213610/11/202100
10213710/11/202100
10323810/11/202120
10323910/11/202110
10324010/11/202100
10324110/11/202100
10324210/11/202100
10324310/11/202120
10344410/11/202110
10344510/11/202120
10374610/11/202110
10374710/11/202120
10384810/11/202110
10384910/11/202100
10385010/11/202100
10385110/11/202100
10385210/11/202120
10395310/11/202110
10395410/11/202100
10395510/11/202100
10395610/11/202100
10405710/11/202110
10405810/11/202110
10405910/11/202120
10406010/11/202110
10416110/11/202120
10416210/11/202120
10426310/11/202120
10426410/11/202120
10426510/11/202100
10426610/11/202110
10426710/11/202100
10426810/11/202100
10426910/11/202100
10427010/11/202120
10457110/11/202110
10457210/11/202100
10457310/11/202100
10457410/11/202100
10457510/11/202120
10467610/11/202120
10477710/11/202120
10497810/11/202120
10497910/11/202100
10498010/11/202100
10498110/11/202100
10508210/11/202110
10508310/11/202100
10508410/11/202100
10508510/11/202100
10508610/11/202120
10548710/11/202110
10548810/11/202120
10568910/11/202120
10569010/11/202100
10569110/11/202100
10569210/11/202100
10569310/11/202120
10569410/11/202100
10569510/11/202100
10569610/11/202100
10579710/11/202120
10579810/11/202100

Hello @shashiPaul1570 

Try the below DAX.

Previous =
VAR CurrentDate = max('Previous Indemnity'[Transaction Date])
RETURN
    CALCULATE (
        SUM ( 'previous indemnity'[Amount] ),
        FILTER (
            ALL ( 'previous indemnity' ),
            'previous indemnity'[Transaction Date] = CALCULATE ( MAX ( 'previous indemnity'[Transaction Date] ), 'previous indemnity'[Transaction Date] < CurrentDate )
        )
    )
NaveenGandhi_0-1685693093012.png

Let me know if you have any questions or issues.

 

If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi Naveen, 
It is not giving me the right result when I am using this measure in a table. 

@shashiPaul1570 

Please check the attached PBIX and let me know if you need any changes.

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.