Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Need help with Measure

Hello All, 

 

Hope you are doing well 🙂

 

I have a measure as mentioned below in pbix which is used to sum of sales for last 7 days . but unfortunately i was not able to see any result in visual . please let me knw what went wrong.

Test Measure =
var a= MAXX(DateTable,DateTable[Future 8 fridays])
var b=a-6
var c=CALCULATE(SUM('Combined Data'[Funding]),'Combined Data'[Approval Date - Forecast]>=b && 'Combined Data'[Approval Date - Forecast]<=a)
return c
 

 

7 Replies

  • dhruvinushah's avatar
    dhruvinushah
    Responsive Resident

    Hi Anonymous ,

    Your measure is working for the MAX date or the last date in the Future 8 Fridays field. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

     

    Try this 

    var a= selectedvalue(DateTable,DateTable[Future 8 fridays])

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

    Hi  Anonymous 

    Thanks for reaching out to us. I need to confirm the questions in the picture below,

     

    Best Regards,

    Community Support Team _Tang

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

    • dhruvinushah's avatar
      dhruvinushah
      Responsive Resident

      Hi v-xiaotang  , Yes i think so. They are trying to create a table visual to show the Week to date sum of the [Funding] field. And just show those WTD values for those Future 8 Fridays fiels as shown in the screenshot above.

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

        Hi dhruvinushah 

        Thanks!

        In this scenario, create the measures below,

        Test Measure = 
        var a= MAXX(all(DateTable),DateTable[Future 8 fridays])
        var b=a-6
        var c=CALCULATE(SUM('Combined Data'[Funding]),'Combined Data'[Approval Date - Forecast]>=b && 'Combined Data'[Approval Date - Forecast]<=a)
        return c

        result ( in card visual)

        If you want to put it into table visual, then use this measure

        Measure = 
        var _maxdate= MAXX(all(DateTable),DateTable[Future 8 fridays])
        var _start =_maxdate-6
        var _sum=CALCULATE(SUM('Combined Data'[Funding]),'Combined Data'[Approval Date - Forecast]>=_start && 'Combined Data'[Approval Date - Forecast]<=_maxdate)
        return IF(MIN(DateTable[Future 8 fridays])= _maxdate, _sum)

        result

         

        Best Regards,

        Community Support Team _Tang

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