Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Latest ID result on Matrix total values

Hello Power BI,

 

I need to dsiplay the latest ID record from an specific column on the totals row. I have done this before with dates but this time I only have ID number.

Thanks for your support.

 

  • Hi, Anonymous 

    According to your description, I can clearly understand your requirement, and I created some test data to achieve your requirement, you can create a new measure like this to replace the original measure [Sum of Scrap percentage] in the matrix:

    This is the test data I created:

     

    Sum of Scrap percentage1 =
    
    var _ID=CALCULATE(MAX('Table'[ID]),FILTER(ALL('Table'),[Customer]=MAX('Table'[Customer])))
    
    var _sum=CALCULATE([Sum of Scrap percentage],FILTER(ALL('Table'),[ID]=_ID&&[Customer]=MAX('Table'[Customer])))
    
    return
    
    SWITCH(
    
        TRUE(),
    
        ISINSCOPE('Table'[Customer])&&ISINSCOPE('Table'[ID]),[Sum of Scrap percentage],
    
        ISINSCOPE('Table'[Customer])&&NOT(ISINSCOPE('Table'[ID])),_sum)

     

     

    And you can get what you want, like this:

     

    You can download my test pbix file below

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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

2 Replies

  • v-robertq-msft's avatar
    v-robertq-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

    According to your description, I can clearly understand your requirement, and I created some test data to achieve your requirement, you can create a new measure like this to replace the original measure [Sum of Scrap percentage] in the matrix:

    This is the test data I created:

     

    Sum of Scrap percentage1 =
    
    var _ID=CALCULATE(MAX('Table'[ID]),FILTER(ALL('Table'),[Customer]=MAX('Table'[Customer])))
    
    var _sum=CALCULATE([Sum of Scrap percentage],FILTER(ALL('Table'),[ID]=_ID&&[Customer]=MAX('Table'[Customer])))
    
    return
    
    SWITCH(
    
        TRUE(),
    
        ISINSCOPE('Table'[Customer])&&ISINSCOPE('Table'[ID]),[Sum of Scrap percentage],
    
        ISINSCOPE('Table'[Customer])&&NOT(ISINSCOPE('Table'[ID])),_sum)

     

     

    And you can get what you want, like this:

     

    You can download my test pbix file below

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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