Forum Discussion

JesseV's avatar
JesseV
Frequent Visitor
4 years ago
Solved

measure that returns another column value based on the current month

I'm looking for a measure that returns the % based on the current month from the following table:

 

 

Datum (Date type)Verwachte voortgang (% type)
Jan 9%
Feb 18%
Mar 28%
Apr35%
May45%
Jun55%

 

So currently I would want the measure to return 55%.

 

I attempted this, but it gives error that it cannot return a single output

 

 

 

Verwachtte vooruitgang = 
SELECTEDVALUE('Voortgang %'[Verwachte voortgang],
FILTER ('Voortgang %'[Datum],'Voortgang %'[Datum].[Maand] = MONTH(TODAY())
))

 

 

  • I ended up cracking it by adding Calculate before the whole thing:

    Verwachtte vooruitgang = 
    CALCULATE(SELECTEDVALUE('Voortgang %'[Verwachte voortgang]),
        Filter('Voortgang %','Voortgang %'[Maand] = MONTH(TODAY()))
    )

     
    Thanks a ton for your assistance onurbmiguel_ 

8 Replies

  • onurbmiguel_'s avatar
    onurbmiguel_
    Icon for Power Participant rankPower Participant

    Hello Jesse 

    Try like this 

     

    Verwachtte vooruitgang = 
    SELECTEDVALUE('Voortgang %'[Verwachte voortgang],
    FILTER (ALL('Voortgang %'),'Voortgang %'[Datum].[Maand] = MONTH(TODAY())
    ))

     

    Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
    Best Regards
    BC

    • JesseV's avatar
      JesseV
      Frequent Visitor

      Hey onurbmiguel_ , thank you for replying.

       

      The measure gives an error: 'The expression references multiple columns. Multiple collumns cannot be converted to a scalair value' (attempted translation on my part ;))

       

      is this because the 'Verwachte voortgang' collumn has multiple %-ages ?

      • onurbmiguel_'s avatar
        onurbmiguel_
        Icon for Power Participant rankPower Participant

        Hi again Jesse, 

        You can share some values ​​from the table to see the structure of the model, and if you are using a calendar table.

         

        BR 

        Bruno

  • JesseV's avatar
    JesseV
    Frequent Visitor

    Naturally, it's a manually added table (where Maand is the month number and date the first day of the month date value) 

    • onurbmiguel_'s avatar
      onurbmiguel_
      Icon for Power Participant rankPower Participant

      Hi again

       

      Verwachtte vooruitgang = 
      SELECTEDVALUE(
      	'Voortgang %'[Verwachte voortgang],
      	FILTER(
      		ALL('Voortgang %'),
      		'Voortgang %'[Maand]= MONTH(TODAY())
      	)
      )

       

      Need to be careful because if you have more than 2 year it will return a error.

       

      Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
      Best Regards
      BC

      • onurbmiguel_'s avatar
        onurbmiguel_
        Icon for Power Participant rankPower Participant

        if you have 2 or more year you can try: 

         

        Verwachtte vooruitgang = 
        SELECTEDVALUE(
        	'Voortgang %'[Verwachte voortgang],
        	FILTER(
        		ALL('Voortgang %'),
        		'Voortgang %'[Datum] = date( year(TODAY()) , MONTH(TODAY()) , 1 )
        	)
        )

         

        Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
        Best Regards
        BC