Forum Discussion

salame's avatar
salame
New Member
1 year ago
Solved

help with dax

I have this dataset: I need to create a sum amount and filter by month such that if the value is blank in that month I get the value of the last previous month that was nonblank.

 

Loan NoAmountDate
LNA-00331849315.3601/01/2025
LNA-00419109589.1612/10/2025
LNA-00631849315.3611/11/2025
LNA-0096369863.2520/11/2025

 

The result for LNA-009 per month to be as shown with December not blank but picks value for November:

Loan NoAmountmonth
LNA-0096369863.25November
LNA-0096369863.25December
  • Hi salame 
    Thank you for reaching out to Microsoft Fabric Community Forum.

    Try with below DAX:

    Amount_Latest = 
    VAR LastAmount = 
        CALCULATE(
            SUM('loan collaterals'[Outstanding Amount]),
            FILTER(
                ALL('Ultimate Calendar'),
                'Ultimate Calendar'[Year] = MAX('Ultimate Calendar'[Year]) &&
                'Ultimate Calendar'[Month] <= MAX('Ultimate Calendar'[Month])
            )
        )
    RETURN
        IF(
            ISBLANK(SUM('loan collaterals'[Outstanding Amount])),
            LastAmount,
            SUM('loan collaterals'[Outstanding Amount])
        )

     

    If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

     

     

    Thank you.

     

8 Replies

  • Hi salame ,

     

    To what I can understand you want to create a line for each month for each loan is that correct?

    A couple of questions on this:

    • Do you want to have this indefinetly for each loan? Is there a end date for each one?
    • Is the amount always the same for all the lines or do your want to do a part of the amount you present on the table?
    • salame's avatar
      salame
      New Member

      line for each month for each loan is that correct?-this is correct.
      yes analysis is done say for a certain year and month...amount should always be nonblack where there has been transaction(amount exist) in that month or not.

      Is the amount always the same for all the lines or do your want to do a part of the amount you present on the table?-that was just an example''there are different amounts for each loan per month. For those months that amount is blank for a certain loan...we should always pick previous value for a month that was nonblank

      • MFelix's avatar
        MFelix
        Super User

        Hi salame ,

         

        Based on the information you have sent can you please send a more complete example so I can get the correct syntax for you.

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi salame 
    Thank you for reaching out to Microsoft Fabric Community Forum.

    Try with below DAX:

    Amount_Latest = 
    VAR LastAmount = 
        CALCULATE(
            SUM('loan collaterals'[Outstanding Amount]),
            FILTER(
                ALL('Ultimate Calendar'),
                'Ultimate Calendar'[Year] = MAX('Ultimate Calendar'[Year]) &&
                'Ultimate Calendar'[Month] <= MAX('Ultimate Calendar'[Month])
            )
        )
    RETURN
        IF(
            ISBLANK(SUM('loan collaterals'[Outstanding Amount])),
            LastAmount,
            SUM('loan collaterals'[Outstanding Amount])
        )

     

    If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

     

     

    Thank you.

     

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi salame 

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

     

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi salame 

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

    Thank you.

  • v-karpurapud's avatar
    v-karpurapud
    Community Support

    Hi salame 

    I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

    Thank you.