Forum Discussion
Anonymous
8 years agoNot applicable
How to compare two strings in consecutive rows and display result in new column
Hi All, I am looking for the solution for a query where in I have created a calculated columns in Power BI. We need to calculate “total shipment count” in Power BI. For calculating total shi...
- 8 years ago
in my syntax the TRUE result was the same shipment, FALSE was 0,
RETURN IF ( 'Table'[Plant_Shpto_Shpment_Gross KG] <> 0, IF ( SameShipment, 0, 1 ), 0 )In your syntax it's reverse, so you either need to change '<>' to '=' to fully reverse the logic, or switch 0 and same shipment condition
Stachu
Community Champion
8 years agotry this
Column =
VAR CurrentIndex = 'Table'[Index]
VAR PreviousShipment =
CALCULATE (
FIRSTNONBLANK ( 'Table'[Plnt_Ship-to_Shpmt_Mat], TRUE ),
FILTER ( 'Table', 'Table'[Index] = CurrentIndex - 1 )
)
VAR SameShipment = 'Table'[Plnt_Ship-to_Shpmt_Mat] = PreviousShipment
RETURN
IF ( 'Table'[Plant_Shpto_Shpment_Gross KG] <> 0, IF ( SameShipment, 0, 1 ), 0 )Anonymous
8 years agoNot applicable
Hi, I tried doing this but "'Table'[Plant_Shpto_Shpment_Gross KG] <> 0" condition is not validating properly. I have attached the snapshot below:
can you please help if i am missing something.
Thanks
- Stachu8 years ago
Community Champion
in my syntax the TRUE result was the same shipment, FALSE was 0,
RETURN IF ( 'Table'[Plant_Shpto_Shpment_Gross KG] <> 0, IF ( SameShipment, 0, 1 ), 0 )In your syntax it's reverse, so you either need to change '<>' to '=' to fully reverse the logic, or switch 0 and same shipment condition
- Anonymous8 years agoNot applicable
ohh I missed that part.
I corrected it. Its giving correct output now.. Thanks a lot....:smileyvery-happy: