Forum Discussion

onurkrbck's avatar
onurkrbck
Regular Visitor
4 years ago
Solved

Using a measure as ResultIfTrue in IF statement

Hi,

 

I have "goals" table and "opportunities" table in Power BI. I created a few "Measures" in goals table by using the data in "opportunities" table. One of these measures are as below. Since there is no sensitive data in the formula, I shared it below as is.

 

Also, there is a multiselect option field in our CRM opportunty entity, field name is "2021 Target". Field is being used to calculate targets. I have splited this field in Power BI to be ale to use it.

 

Below formula gives the result of that the sum of the revenues of the opportunities which "Hardware Sales Revenue" option has been choosen in the 2021 Target field.

 

Funnel Hardware Sales Revenue = CALCULATE(SUM('opportunities'[Revenue]) , FILTER('opportunities' 'opportunities'[new_2021target.1value]="Hardware Sales Revenue" || 'opportunities'[new_2021target.2value]="Hardware Sales Revenue" || 'opportunities'[new_2021target.3value]="Hardware Sales Revenue" || 'opportunities'[new_2021target.4value]="Hardware Sales Revenue" || 'opportunities'[new_2021target.5value]="Hardware Sales Revenue"))
 
This formula works fine. There is no problem at it.

 

The point I stuck is I want to add a new column into goals table and I want to use IF statement in this column.
 
Let's say goal title is "ABC"
 
The formula I want to use in the new column:
IF(goals[title]="ABC",[Funnel Hardware Sales Revenue],0)
 
When I tried the use this formula, all falses give "0" but true does not give antthing. That row does not have any data in this new column.
 
How can I solve this?
 
Thanks
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi onurkrbck ,

     

    The syntax you used is incorrect. To my knowledge, we could not get the column title via DAX.

     

     

    I have created a data sample:

     

          

     

    Then you could directly use 

    ABC = [Funnel Hardware Sales Revenue]

    to create a ABC column.

     

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

3 Replies

  • PC2790's avatar
    PC2790
    Icon for Community Champion rankCommunity Champion

    Would it be possible for you to provide the data model?

    It'll be easier to understand the problem

    • onurkrbck's avatar
      onurkrbck
      Regular Visitor

      Hi,

      I am not experienced in Power BI. So my data model could be "weird" to you.

      Sorry for the inconvenience 🙂

       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi onurkrbck ,

     

    The syntax you used is incorrect. To my knowledge, we could not get the column title via DAX.

     

     

    I have created a data sample:

     

          

     

    Then you could directly use 

    ABC = [Funnel Hardware Sales Revenue]

    to create a ABC column.

     

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