Forum Discussion

Dgpte's avatar
Dgpte
Frequent Visitor
4 years ago

row context conditional

Hello!
I need to create a measure:
I have 'Table1'[Type]. Has values " 1,2 and 3".
I want each value "1" to create a variable "x". This variable "x" will end 10 days afther it is created. 
The creation date is 'Table1'[Date].
 
So, I  tried to create "x", but the conditional function doesn´t work whit the row context. I tried again:
calculate( count('Table1'[Type]), 'Table1'[Type]= "1") but i dont know how to create an x of each value 1.
I am stuck.
 
thank you!!

4 Replies

  • bcdobbs's avatar
    bcdobbs
    Community Champion

    Hi,
    Are you able to provide a demo pbix file and an idea of the final result you're after.

     

    From your description I think you might want a calculated column rather than a measure. The measure you give doesn't have an iterator in it so has no concept of a row. Hoping can help more with a demo file!

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    I am not sure if I understood correctly, but basically you want to calculate your values if their "type" is 1 and they have been created within the past 10 days?

    Test data:
    Excpected result is 2

    Dax:

    TypeCount =
    CALCULATE(COUNTROWS(TypeCount),TypeCount[Type]=1,DATESBETWEEN(TypeCount[Date],TODAY()-10,TODAY()))

    End result:


    I am not sure if I understood what you are trying to do, but I hope this helps and if it does consider accepting this as a solution and giving the post a thumbs up!

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

    Hi Dgpte 

     

    Is this what you want?

    Measure = 
    var vDate = IF(SELECTEDVALUE(Table1[Type])="1",SELECTEDVALUE(Table1[Date])+10,BLANK())
    return
    vDate

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.