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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
pankajj
Helper III
Helper III

Convert Crystal Report Formula to use in Power BI query

Dear community,
I have an existing report done with Crystal Report.  While converting it to Power BI, I am stuck at the following Formula:

 

local stringvar warehouse := "";

if {Command.ABD_ORDER_POINT} - {Command.ABD_QIS} + {Command.ABD_QID} > {Command.ABDNetQty} then
(IF warehouse = "" then warehouse := warehouse + "*ABD*" else warehouse := warehouse + ", *ABD*")
else if {Command.ABD_ORDER_POINT} > 0 then
(if warehouse = "" then warehouse := warehouse + "ABD" else warehouse := warehouse + ", ABD");

if {Command.ALS_ORDER_POINT} - {Command.ALS_QIS} + {Command.ALS_QID} > {Command.ALSNetQty} then
(IF warehouse = "" then warehouse := warehouse + "*ALS*" else warehouse := warehouse + ", *ALS*")
else if {Command.ALS_ORDER_POINT} > 0 then
(IF warehouse = "" then warehouse := warehouse + "ALS" else warehouse := warehouse + ", ALS");

if {Command.ALSVC_ORDER_POINT} - {Command.ALSVC_QIS} + {Command.ALSVC_QID} > {Command.ALSVCNetQty} then
(IF warehouse = "" then warehouse := warehouse + "*ALS-VC*" else warehouse := warehouse + ", *ALS-VC*")
else if {Command.ALSVC_ORDER_POINT} > 0 then
(IF warehouse = "" then warehouse := warehouse + "ALS-VC" else warehouse := warehouse + ", ALS-VC");

if isnull({Command.NEXT_ORDER_REQUIRED_BY}) = false then
(IF warehouse = "" then warehouse := warehouse + "*" + (IF {Command.DEMAND_WHSE} = "UNIVERSAL" THEN "C2" ELSE {Command.DEMAND_WHSE}) + "*" else warehouse := warehouse + ", *" + (IF {Command.DEMAND_WHSE} = "UNIVERSAL" THEN "C2" ELSE {Command.DEMAND_WHSE}) + "*");

warehouse

 

We have so many great talent in the community, looking forward for a quick help.

 

Thank you very much in advance.

2 REPLIES 2
dax
Community Support
Community Support

Hi pankajj,

I am not professional in crystal report, in your scenario, it looks like the conditional column, so if possible, could you please inform me more detailed information(such as your sample data and your expected output)? Then I will help you more correctly.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Zoe,

 

Thanks so much for your response. and sorry for the late reply. I did not receive any email alert on your response.

 

The Crystal query defines the 'Warehouse' based on various conditions. I was able to convert the query to run in Power BI as below however Power BI is not able to recognize 'warehouse'

 

if ([ABD_ORDER_POINT] - [ABD_QIS] + [ABD_QID]) > [ABDNetQty] then
if warehouse = "" then warehouse & "*ABD*" else warehouse & " *ABD*"
else if [ABD_ORDER_POINT] > 0 then
if warehouse = "" then warehouse & "ABD" else warehouse & ", ABD" else

if ([ALS_ORDER_POINT] - [ALS_QIS] + [ALS_QID]) > [ALSNetQty] then
if warehouse = "" then warehouse & "*ALS*" else warehouse & ", *ALS*"
else if [ALS_ORDER_POINT] > 0 then
if warehouse = "" then warehouse & "ALS" else warehouse & ", ALS" else

if ([ALSVC_ORDER_POINT] - [ALSVC_QIS] + [ALSVC_QID]) > [ALSVCNetQty] then
if warehouse = "" then warehouse & "*ALS-VC*" else warehouse & ", *ALS-VC*"
else if [ALSVC_ORDER_POINT] > 0 then
if warehouse = "" then warehouse & "ALS-VC" else warehouse & ", ALS-VC" else

if [NEXT_ORDER_REQUIRED_BY] <> null then
if warehouse = "" then warehouse & "*" & (if [DEMAND_WHSE] = "UNIVERSAL" then "C2" else [DEMAND_WHSE]) & "*" else warehouse & ", *" & (if [DEMAND_WHSE] = "UNIVERSAL" then "C2" else [DEMAND_WHSE]) & "*"
else
warehouse

 

Can you help.

 

Thank you very much for your support.

 

Best regards,

 

Pankajj

 

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors
Top Kudoed Authors