Forum Discussion

michael_knight's avatar
michael_knight
Icon for Post Prodigy rankPost Prodigy
6 years ago

Target Measure doesn't use current month, uses appended query

Hi,

 

I'm trying to create a target measure. I've got two targets which are the same.

 

The black line target in a formula target based on a numbers within the system, the red target is manually given to me at the start of each month and used for the duration of the month until there is enough data in the system. 

 

 

I want to create a measure that uses the black line for every single month apart from the current month, and use the red line for only the current month

 

Any help would be appriciated

 

If you have any question please don't hesitate to ask

 

Thanks,

Mike

6 Replies

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

    Hi michael_knight ,

     

    Do you mean to create a single line with these two lines?

    You could use IF() and SELECTEDVALUE() functions to judge if it is current month. If it returns TRUE, you could use the measure of red line. If it returns FALSE, you could use the measure of blank line.

     

    • michael_knight's avatar
      michael_knight
      Icon for Post Prodigy rankPost Prodigy

      Hi v-eachen-msft ,

       

      Yes I do want them in the same line

       

      Sorry, I'm still learning DAX. I tried with the code below but I have had no luck. 

      IsCurrentMonth = 
      IF( 
          SELECTEDVALUE(Appointment[createdon].[Date]) =MONTH(NOW(),[Target], 'Targets- WBAH'[WBAH Target]))

       

      The theory I want is

       

      If current month, return 'Target', else return 'WBAH Target' 

       

      Any suggestions

       

      Thanks,

      Mike

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

        Hi michael_knight ,

         

        You could try the following DAX:

        IsCurrentMonth =
        IF (
            SELECTEDVALUE ( MONTH ( Appointment[createdon] ) ) = MONTH ( NOW () ),
            [Target],
            SELECTEDVALUE ( 'Targets- WBAH'[WBAH Target] )
        )

        All values you return need to be measure.