locked
DAX expression RRS feed

  • Question

  • how can we compare values of to dimensions in if statement 

    EX

    if(dim1.column=dim2.column,true,false)

    Friday, May 24, 2019 5:31 AM

Answers

  • i want to compare two dimension attributes in a single if statement

    Example

    IF('Forecast Version'[Quarter]='Time Accounting Period'[Quarter],"forecast","actuals")

    The premise is that the two tables "Forecast Version", "Time Accounting Period" have relationship, so that the DAX statement could be written like this.

    =IF('Forecast Version'[Quarter]=RELATED('Time Accounting Period'[Quarter]),"forecast","actuals")

    Best Regards,

    Will


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 30, 2019 7:27 AM

All replies

  • how can we compare values of to dimensions in if statement 

    EX

    if(dim1.column=dim2.column,true,false)

    Not clear what your have expressed, could you please use some sample data to support your thought?

    Or you mean to want this?

    If column contains values from column in another table...

    Best Regards,

    Will


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 27, 2019 9:11 AM
  • i want to compare two dimension attributes in a single if statement

    Example

    IF('Forecast Version'[Quarter]='Time Accounting Period'[Quarter],"forecast","actuals")

    Wednesday, May 29, 2019 9:14 AM
  • i want to compare two dimension attributes in a single if statement

    Example

    IF('Forecast Version'[Quarter]='Time Accounting Period'[Quarter],"forecast","actuals")

    The premise is that the two tables "Forecast Version", "Time Accounting Period" have relationship, so that the DAX statement could be written like this.

    =IF('Forecast Version'[Quarter]=RELATED('Time Accounting Period'[Quarter]),"forecast","actuals")

    Best Regards,

    Will


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 30, 2019 7:27 AM
  • thanks 
    Friday, May 31, 2019 8:21 AM