Forum Discussion

arav007's avatar
arav007
Frequent Visitor
4 years ago
Solved

power Bi measure

I have 2 datecolumns G&H, have to write a measure -when H date> G date and H date falls within 12 months from now then value column have to show Region . and viceversa

GHValue
06/07/201603/22/2021Region
05/22/201506/22/2021Region
03/22/202105/22/2015polls
  • Hi, arav007 

     

    Please check the following methods.

    Value = 
    IF (
        OR ( [H] > [G], [H] IN DATESINPERIOD ( 'Date'[Date], TODAY (), 12, MONTH ) ),
        "region",
        "polls"
    )

     

    Measure:

    Value M = 
    IF (
        OR ( SELECTEDVALUE('Table'[H]) > SELECTEDVALUE('Table'[G]),
        SELECTEDVALUE('Table'[H]) IN DATESINPERIOD ( 'Date'[Date], TODAY (), 12, MONTH ) ),
        "region",
        "polls"
    )

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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

3 Replies

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

    Hi, arav007 

     

    Please check the following methods.

    Value = 
    IF (
        OR ( [H] > [G], [H] IN DATESINPERIOD ( 'Date'[Date], TODAY (), 12, MONTH ) ),
        "region",
        "polls"
    )

     

    Measure:

    Value M = 
    IF (
        OR ( SELECTEDVALUE('Table'[H]) > SELECTEDVALUE('Table'[G]),
        SELECTEDVALUE('Table'[H]) IN DATESINPERIOD ( 'Date'[Date], TODAY (), 12, MONTH ) ),
        "region",
        "polls"
    )

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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

  • Barthel's avatar
    Barthel
    Solution Sage

    Hey,

     

    Try this: (DimCalendar is my date table and 'Table' is the table for which it's calculating 'Value').

     

     

     

    Value =
    IF (
        AND (
            'Table'[H] > 'Table'[G],
            'Table'[H] IN DATESINPERIOD ( DimCalendar[Date], TODAY (), -12, MONTH )
        ),
        "Region",
        "polls"
    )


    If the condition is met 'Region' is returned, if not 'polls'. Is this what you expect?

     

     

    • arav007's avatar
      arav007
      Frequent Visitor

      H>G -Value =region, G>H -value =polls, for both date falls within 12 months from now , like in dateslicer when we are selecting todays date, so in that you can see 1st row H>G so value should reflect "Region"