Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hi, I'm using that one measure for getting correct values for first and last payment, but that one does not work for each item.
How can I filter for each item ?
Solved! Go to Solution.
HI @GINMED,
You can try to use the following measure formula if it helps:
KASKO_total =
VAR firstP =
CALCULATE (
MIN ( 'Project'[Sequence] ),
ALLSELECTED ( 'Project' ),
VALUES ( 'Project'[PL Nr.] )
)
VAR lastP =
CALCULATE (
MAX ( 'Project'[Sequence] ),
ALLSELECTED ( 'Project' ),
VALUES ( 'Project'[PL Nr.] )
)
VAR CurrentSeq =
SELECTEDVALUE ( 'Project'[Sequence] )
VAR CurrentP =
SELECTEDVALUE ( 'Project'[KASKO] )
RETURN
SWITCH (
CurrentSeq,
firstP, 'Calculation'[kasko_first],
lastP, 'Calculation'[kasko_last],
CurrentP
)
Regards,
Xiaoxin Sheng
Hi,
It should work.
Would you please share sample data and your expectation ?
my expectation:
correct payments(kasko_first & kasko_last) per each item, like below
Now it shows incorrect values for last payment per item, it shows only correct for last one sequence, not for each item
Hi @GINMED,
You can try to use the item as the category to filter on the iterator function sumx calculations:
formula =
VAR FirstPayment =
MINX ( VALUES ( 'Līgumi_Project'[Item] ), ( 'Līgumi_Project'[Sequence] ) )
VAR LastPayment =
MAXX ( VALUES ( 'Līgumi_Project'[Item] ), ( 'Līgumi_Project'[Sequence] ) )
VAR CurrentSequence =
SELECTEDVALUE ( 'Līgumi_Project'[Sequence] )
VAR CurrentPayment =
SELECTEDVALUE ( 'Līgumi_IFRS'[KASKO, EUR] )
VAR result =
SWITCH (
CurrentSequence,
FirstPayment, CALC_NOMAS_MAKS[KASKO_FIRST],
LastPayment, CALC_NOMAS_MAKS[KASKO_LAST],
CurrentPayment
)
RETURN
result
Regards,
Xiaoxin Sheng
@Anonymous
thank you, but that one does not work for me
Hi @GINMED,
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
HI @GINMED,
You can try to use the following measure formula if it helps:
KASKO_total =
VAR firstP =
CALCULATE (
MIN ( 'Project'[Sequence] ),
ALLSELECTED ( 'Project' ),
VALUES ( 'Project'[PL Nr.] )
)
VAR lastP =
CALCULATE (
MAX ( 'Project'[Sequence] ),
ALLSELECTED ( 'Project' ),
VALUES ( 'Project'[PL Nr.] )
)
VAR CurrentSeq =
SELECTEDVALUE ( 'Project'[Sequence] )
VAR CurrentP =
SELECTEDVALUE ( 'Project'[KASKO] )
RETURN
SWITCH (
CurrentSeq,
firstP, 'Calculation'[kasko_first],
lastP, 'Calculation'[kasko_last],
CurrentP
)
Regards,
Xiaoxin Sheng
@Anonymous Thank you so much, this one works perfectly!!!
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.