DAX 'IF' question

2avrham

Board Regular
Joined
May 12, 2014
Messages
104
Office Version
  1. 365
Hi all,

I having issue to "search" for specific text when I use IF faction at Dax.

I have the next code:
=IF([TesterName]="G1", IF([status] = 'Active',[status],[status]))


that should search for "G1" under "TesterName" column.

My problem is that at Testername column data is XXXXG1, CCCCCG1 and I don't now how to edit it to take those cells too (to ignore al text data from the beginning like '%G1" at SQL.

thanks!!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
show us a few rows of data as it arrives from the SQL query and show us your desired output
 
Upvote 0
MTDateWeekdayNon PrimeTimeNon Prime Time hourTesterName
1/27/2017 3:45:00 AM603CMT0289
1/27/2017 3:45:00 AM603CMT0062G1
1/27/2017 3:45:00 AM603CMT0062
1/27/2017 3:45:00 AM603CMT0289G1
1/27/2017 3:30:00 AM603CMT0289
1/27/2017 3:30:00 AM603CMT0062G1
1/27/2017 3:30:00 AM603CMT0062
1/27/2017 3:30:00 AM603CMT0289G1
1/27/2017 3:15:00 AM603CMT0062G1
1/27/2017 3:15:00 AM603CMT0289
1/27/2017 3:15:00 AM603CMT0062
1/27/2017 3:15:00 AM603CMT0289G1
1/27/2017 3:00:00 AM603CMT0289
1/27/2017 3:00:00 AM603CMT0062G1
1/27/2017 3:00:00 AM603CMT0062
1/27/2017 3:00:00 AM603CMT0289G1

<tbody>
</tbody>
 
Upvote 0
Where's the 'status' column?

Also, what do you want to return if 'G1' isn't found in column 'TesterName'?
 
Upvote 0
This will return 'Yes' if 'G1' is found in the TesterName column and 'No' if it isn't.

= IF(ISERROR(SEARCH("G1",Table1[TesterName])), "No", "Yes")
 
Upvote 0
I saw that I miss something here, I attach all data + explanation for what im hope to retrieve.

MTDateWeekdayNon PrimeTimeNon Prime Time hourTesterNameDayLoginTesterStatusTesterStatestatus
1/26/2017 23:155123CMT0748G12638Logged Out
1/26/2017 23:305123CMT0748G12638Logged Out
1/26/2017 23:155123CMT0289G12638Logged Out
1/26/2017 23:305123CMT0289G12638Logged Out
1/26/2017 23:155123CMT0395G12638Logged Out
1/26/2017 23:305123CMT0395G12638Logged Out
1/26/2017 23:155123CMT0441G12638Logged Out
1/26/2017 23:305123CMT0441G12638Logged Out
1/26/2017 23:155123CMT0628G12638Logged Out
1/26/2017 23:305123CMT0628G12638Logged Out
1/26/2017 23:155123CMT0625G12638Logged Out
1/26/2017 23:305123CMT0625G12638Logged Out
1/26/2017 23:155123CMT0327G12638Logged Out
1/26/2017 23:305123CMT0327G12638Logged Out
1/26/2017 23:155123CMT0291G12678Down
1/26/2017 23:305123CMT0291G12678Down
1/26/2017 23:155123CMT05342621Inactive
1/26/2017 23:305123CMT05342621Inactive
1/26/2017 23:155123CMT0534G12621Inactive
1/26/2017 23:305123CMT0534G12621Inactive
1/26/2017 23:155123CMT028926ekuprian12Active
1/26/2017 23:305123CMT044126ekuprian13Active
1/26/2017 23:305123CMT029126ekuprian13Active
1/26/2017 23:155123CMT029126ekuprian13Active
1/26/2017 23:305123CMT039526Not Detected13Active
1/26/2017 23:155123CMT032726ekuprian13Active
1/26/2017 23:305123CMT032726ekuprian13Active
1/26/2017 23:155123CMT062826ekuprian13Active
1/26/2017 23:305123CMT062826ekuprian13Active
1/26/2017 23:155123CMT039426epimus13Active
1/26/2017 23:305123CMT039426epimus13Active
1/26/2017 23:155123CMT074826alexeyra13Active
1/26/2017 23:305123CMT074826alexeyra13Active
1/26/2017 23:305123CMT062526ekuprian13Active
1/26/2017 23:155123CMT039526Not Detected17Active
1/26/2017 23:305123CMT028926ekuprian17Active
1/26/2017 23:155123CMT044126ekuprian17Active
1/26/2017 23:155123CMT0062G126guol127Inactive
1/26/2017 23:305123CMT0062G126guol127Inactive
1/26/2017 23:155123CMT006226agvinchh27Inactive
1/26/2017 23:305123CMT006226agvinchh27Inactive
1/26/2017 23:155123CMT062526ekuprian17Active

<tbody>
</tbody><colgroup><col><col><col><col><col><col><col><col span="2"><col></colgroup>




What I hope to retrieve is dax code that his search base on:
if on the same two rows (cell row & the row that below to here) status appears as "Active" (even for one of them) print "Active" on original cell and leave it blank for lower row & moved on to the next cell (row 3 now).
otherwise take "status" from "Tester name" that not include "G1" text data and below row can be blank.


I hope it more clear now :) thanks!!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,475
Messages
6,125,028
Members
449,205
Latest member
Eggy66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top