Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jtstacruz
Frequent Visitor

PowerBI DAX: VAR FUNCTION (with if and filter functions) ERROR

Hello! I am just an absolute beginner in BI and I am having a hard time formulating a measure in DAX that could filter specific values in columns. However, I don't know if my execution or use of functions are correct. The thing that I would like to happen is to first count occurrences of which "RCA" term appeared in the title column, if it did then it should categorize it into FBI if not then CIA. Second, I want to combine it all together and filter those only that are "CIA" from the title, then from the client column "NSE" then from the status column "In-Progress" I just want to count the number of rows from the three conditions and display it in a card. Is there any suggestion of how to do this? Or anyone to correct the measure I've done? I got an error in the first line of var which points to Final['Title']. Here is my measure: NSE IP NEW = VAR FindAssignee = FILTER(VALUES(Final[Title]), COUNTROWS(FILTER(ALL(Final[Title]) VAR Condition=IF((SEARCH("RCA", [Title], 1, 0) > 0), "CIA", "FBI")) VAR FilteredNSE = FILTER(Final, Final[Assignee]="CIA", Final[Client]="NSE" && Final[Status]="In-Progress") RETURN CALCULATE(COUNTROWS('Final'), FindAssignee, Condition, FilteredNSE) Anyone's help will be really appreciated. Thank you!
1 ACCEPTED SOLUTION
v-cherch-msft
Employee
Employee

Hi @jtstacruz

 

You may try below measure with SEARCH Function.

Measure  =
COUNTROWS (
    FILTER (
        Final,
        SEARCH ( "RCA", Final[Title], 1, 0 ) = 0 //search "RCA" not appear in the title column
            && Final[Client] = "NSE"
            && Final[Status] = "In-Progress"
    )
)

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-cherch-msft
Employee
Employee

Hi @jtstacruz

 

You may try below measure with SEARCH Function.

Measure  =
COUNTROWS (
    FILTER (
        Final,
        SEARCH ( "RCA", Final[Title], 1, 0 ) = 0 //search "RCA" not appear in the title column
            && Final[Client] = "NSE"
            && Final[Status] = "In-Progress"
    )
)

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.