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.
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 shipment count we need to apply two conditions:
I have used following formula in power BI but its showing error.
I also tried changing the data type for Shipment number but due to "0101_150190142_DRX0062220_1720.91" type of values it's giving error as "Cannot convert value '0101_150190142_DRX0062220_1720.91' of type Text to type Integer".
Can someone please help.
Thanks
Solved! Go to Solution.
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
try 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 )
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
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
ohh I missed that part.
I corrected it. Its giving correct output now.. Thanks a lot....
@Anonymous
I believe you can use
VALUES or MIN or MAX or SELECTEDVALUE
instead of
SUM
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |