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
GINMED
Helper III
Helper III

Correct values per item

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 ?

 

var FirstPayment = MINX(ALLSELECTED('Līgumi_Project'), ('Līgumi_Project'[Sequence]))
var LastPayment = MAXX(ALLSELECTED('Līgumi_Project'), ('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
 
 
 
1 ACCEPTED 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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

9 REPLIES 9
MahyarTF
Memorable Member
Memorable Member

Hi,

It should work.

Would you please share sample data and your expectation ?

Mahyartf

@MahyarTF 

my expectation:

correct payments(kasko_first & kasko_last) per each item, like below

GINMED_0-1662109988465.png

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft 

thank you, but that one does not work for me

GINMED_0-1662470832097.png

 

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft  there is my sample data

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft Thank you so much, this one works perfectly!!!

 

@MahyarTF 

GINMED_2-1662110463354.png

 

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.