Forum Discussion
Tom_G
7 years agoHelper II
IF Statement with Filter
Hi - i'm new to DAX. I have table with a column with the name of plants and another column with the types of access to them listed on separate rows - such as LoadingTruck, ReceivingTruck, LoadingShip...
- 7 years ago
Hi Tom_G ,
To create two calculated column as below.
type = VAR load = LEN ( "Loading" ) VAR rece = LEN ( "Receiving" ) VAR searl = SEARCH ( "Loading", 'Table1'[Access Types], 1, BLANK () ) VAR searr = SEARCH ( "Receiving", 'Table1'[Access Types], 1, BLANK () ) RETURN IF ( searl <> BLANK (), RIGHT ( 'Table1'[Access Types], LEN ( 'Table1'[Access Types] ) - load ), IF ( searr <> BLANK (), RIGHT ( 'Table1'[Access Types], LEN ( 'Table1'[Access Types] ) - rece ) ) )Column = VAR countr = CALCULATE ( COUNTROWS ( Table1 ), FILTER ( Table1, Table1[Plant Name] = EARLIER ( Table1[Plant Name] ) && Table1[type] = EARLIER ( Table1[type] ) ) ) RETURN IF ( countr > 1, "Bidirectional", "Onedirection" )Pbix as attached.
parry2k
7 years agoSuper User
Tom_G read this post to get your answer quickly.
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490