function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Othmane MikouOthmane Mikou 

Challenge Not yet complete... here's what's wrong: The 'Top Laptop Industry' lens does not appear to have the correct query. Please check the requirements and ensure everything is setup correctly.

Hello all, I receive the following message in Trailhead. I think that the exploration and filter are set up properly. I don't know what I am doing wrong. Would you please help?
Amit Chaudhary 8Amit Chaudhary 8
Please check below post for same issue. If tha will help you
1) https://developer.salesforce.com/forums/?id=9060G000000Ub6RQAS
2) https://developer.salesforce.com/forums/?id=9060G000000I3qxQAC

Let us know if this will help you
Othmane MikouOthmane Mikou
Amit,

Thanks for your response. I checked the links you have provided, and it looks like there is a problem in the module and the developers are trying to fix it.

Best regards
Othmane MikouOthmane Mikou
Amit,

Thanks for your response. I checked the links you have provided, and it looks like there is a problem in the module and the developers are trying to fix it.

Best regards
Clayton Thomas 25Clayton Thomas 25
"When @pchoi says "It's also important to follow the order of the challenges", he means it!
I was getting the 'lens does not appear to have the correct query' error, even after the above announcement that the challenge was fixed. My query looked correct -- but I knew that I had added the "Product Name" Group By first mistakenly (before adding the "Industry" Group By). Even though I deleted the "Product Name" group by (so that Industry was now first), and then re-added it, I got the malformed query error above.
I deleted my lens, started from scratch, and all worked well. "
quoted from: https://developer.salesforce.com/forums/?id=9060G000000I3qxQAC

In other words, you cannot modify an existing lens to pass this challenge, but must start a new lens from scratch, and apply each of the steps in the order directed in order to pass the challenge. 
Bharath Kumar 253Bharath Kumar 253
HI i m facing same issue and followed all solutions in this post but still getting errorlens which i created. would any one help me 
Doug DunfeeDoug Dunfee
Hey everyone, thanks for starting this thread!  I shared it on Twitter and was able to get a bit more info.  If you create multiple lenses and get this error you can try 2 things.  Unfortunately the Trailhead team has limited options with the Wave API to validate these and so it can have issues if the "name" isn't exact.
  1. Try editing the Lense JSON directly with [CTRL=E] or /JSON at the end and MAKE SURE the name is exactly Top_Laptop_Industry.
  2. Delete any Lens you may have named Top Laptop Industry to clear the name "space", then recreate.
E.G. - https://yourorgname-dev-ed.my.salesforce.com/analytics/wave/wave.apexp?tsid=02u1N000001DJe9#lens/0FK1N000000fQeUWAU/json

Here's the top part of my Lens JSON
{
    "name": "Top_Laptop_Industry",
    "label": "Top Laptop Industry",
    "visualizationType": "stackhbar",
    "state": {
        "dataSourceLinks": [],
        "filters": [],
        "gridLayouts": [],
        "layouts": [],
        "steps": {
            "aggregateflex": {
                "broadcastFacet": false,
                "datasets": [
                    {
                        "name": "DTC_Opportunity_SAMPLE"
                    }
                ],
                "isGlobal": false,
                "query": {
                    "measures": [
                        [
                            "sum",
                            "Amount"
                        ]
                    ],
                    "groups": [
                        "Industry",
                        "Product_Name"
                    ],
                    "order": [
                        [
                            "sum_Amount",
                            {
                                "ascending": false
                            }
                        ]
                    ],

 
Doug DunfeeDoug Dunfee
Oops, I tried to bold inside the code around name and it translated it to <b> </b> :)  Don't put that in there.  If this works for you please mark as the answer so others can find easily.
Amit Asthana 3Amit Asthana 3
I am still facing the issue. I have tried all steps as mentioned in the above and related threads. I have completed the "Analyze your data over time" challenge though.
SKollcakuSKollcaku

Hi all, 

I have exactly the same issue; how can this be resolved?


Thanks,
Skender

Lidia Privantu 4Lidia Privantu 4
It is still not working, not even in the json option. I have the error "The 'Top Laptop Industry' lens does not appear to have the correct query. Please check the requirements and ensure everything is setup correctly." Even though everything is set correctly. Is there anything wrong here? Thank you!
 {
    "name": "Top_Laptop_Industry",
    "label": "Top Laptop Industry",
    "visualizationType": "stackhbar",
    "state": {
        "steps": {
            "aggregateflex": {
                "type": "aggregateflex",
                "visualizationParameters": {
                    "visualizationType": "stackhbar",
                    "options": {}
                },
                "datasets": [
                    {
                        "id": "0Fb1t000000Ce7cCAC",
                        "name": "DTC_Opportunity_SAMPLE",
                        "label": "DTC Opportunity",
                        "url": "/services/data/v43.0/wave/datasets/0Fb1t000000Ce7cCAC"
                    }
                ],
                "useGlobal": true,
                "isGlobal": false,
                "selectMode": "multi",
                "broadcastFacet": false,
                "receiveFacet": false,
                "query": {
                    "measures": [
                        [
                            "sum",
                            "Amount"
                        ]
                    ],
                    "groups": [
                        "Industry",
                        "Product_Name"
                    ],
                    "filters": [
                        [
                            "Product_Family",
                            [
                                "Laptops"
                            ],
                            "in"
                        ],
                        [
                            "Won",
                            [
                                "true"
                            ],
                            "in"
                        ]
                    ],
                    "order": [
                        [
                            "sum_Amount",
                            {
                                "ascending": false
                            }
                        ]
                    ]
                }
            }
        },
        "widgets": {
            "aggregateflex_chart": {
                "type": "chart",
                "parameters": {
                    "visualizationType": "stackhbar",
                    "autoFitMode": "keepLabels",
                    "theme": "wave",
                    "step": "aggregateflex",
                    "title": {
                        "label": "",
                        "fontSize": 14,
                        "subtitleLabel": "",
                        "subtitleFontSize": 11,
                        "align": "center"
                    },
                    "showValues": true,
                    "axisMode": "multi",
                    "dimensionAxis": {
                        "showAxis": true,
                        "showTitle": true,
                        "title": "",
                        "customSize": "auto",
                        "icons": {
                            "useIcons": false,
                            "iconProps": {
                                "column": "",
                                "fit": "cover",
                                "type": "round"
                            }
                        }
                    },
                    "measureAxis1": {
                        "sqrtScale": false,
                        "showAxis": true,
                        "customDomain": {
                            "showDomain": false
                        },
                        "showTitle": true,
                        "title": ""
                    },
                    "measureAxis2": {
                        "sqrtScale": false,
                        "showAxis": true,
                        "customDomain": {
                            "showDomain": false
                        },
                        "showTitle": true,
                        "title": ""
                    },
                    "legend": {
                        "show": true,
                        "showHeader": true,
                        "inside": false,
                        "descOrder": false,
                        "position": "right-top",
                        "customSize": "auto"
                    },
                    "tooltip": {
                        "customizeTooltip": false,
                        "showDimensions": true,
                        "dimensions": "",
                        "showMeasures": true,
                        "measures": "",
                        "showPercentage": true,
                        "showBinLabel": true
                    },
                    "trellis": {
                        "enable": false,
                        "showGridLines": true,
                        "flipLabels": false,
                        "type": "x",
                        "chartsPerLine": 4,
                        "size": [
                            100,
                            100
                        ]
                    },
                    "applyConditionalFormatting": true,
                    "exploreLink": true,
                    "columnMap": {
                        "trellis": [],
                        "plots": [
                            "sum_Amount"
                        ],
                        "dimensionAxis": [
                            "Industry"
                        ],
                        "split": [
                            "Product_Name"
                        ]
                    },
                    "normalize": false
                }
            }
        }
    },
    "datasets": [
        {
            "id": "0Fb1t000000Ce7cCAC",
            "name": "DTC_Opportunity_SAMPLE",
            "url": "/services/data/v43.0/wave/datasets/0Fb1t000000Ce7cCAC"
        }
    ]
}
fifedog15fifedog15
OK so I too received this and after reading this I was able to resolve. I followed the bulleted point steps and built the lens in this manner. Then I passed.
  1. Delete the lens and start over 
  2. BUILD IN ORDER OF BULLET POINTS
    1. Click on your Dataset: DTC Opportunity
    2. Select Chart Type: Stacked Bar
    3. Set Bars: Industry
    4. Set Bar Segments: Product Name
    5. Set Bar Length: Sum of Amount
    6. Set Sort: Descending
    7. Set Filters: Product Family Laptops
    8. Set Filters: Won true
    9. Set Lens Name: Top Laptop Industry
    10. Save Lens into the App: My Exploration
Lachlan Stott 18Lachlan Stott 18
I followed @fifedog15's instructions, and despite it being exactly the same as what I had before, it worked fine the second time. Perhaps it has to be in that exact order so that the query is built in that exact manner.

Query was 
{
    "name": "Top_Laptop_Industry",
    "label": "Top Laptop Industry",
    "visualizationType": "stackhbar",
    "state": {
        "steps": {
            "aggregateflex": {
                "type": "aggregateflex",
                "visualizationParameters": {
                    "visualizationType": "stackhbar",
                    "options": {}
                },
                "datasets": [
                    {
                        "id": "0Fb6F000000GcpYSAS",
                        "name": "DTC_Opportunity_SAMPLE",
                        "label": "DTC Opportunity",
                        "url": "/services/data/v43.0/wave/datasets/0Fb6F000000GcpYSAS"
                    }
                ],
                "useGlobal": true,
                "isGlobal": false,
                "selectMode": "multi",
                "broadcastFacet": false,
                "receiveFacet": false,
                "query": {
                    "measures": [
                        [
                            "sum",
                            "Amount"
                        ]
                    ],
                    "groups": [
                        "Industry",
                        "Product_Name"
                    ],
                    "order": [
                        [
                            "sum_Amount",
                            {
                                "ascending": false
                            }
                        ]
                    ],
                    "filters": [
                        [
                            "Product_Family",
                            [
                                "Laptops"
                            ],
                            "in"
                        ],
                        [
                            "Won",
                            [
                                "true"
                            ],
                            "in"
                        ]
                    ]
                }
            }
        },
        "widgets": {
            "aggregateflex_chart": {
                "type": "chart",
                "parameters": {
                    "visualizationType": "stackhbar",
                    "autoFitMode": "keepLabels",
                    "theme": "wave",
                    "step": "aggregateflex",
                    "title": {
                        "label": "",
                        "fontSize": 14,
                        "subtitleLabel": "",
                        "subtitleFontSize": 11,
                        "align": "center"
                    },
                    "showValues": true,
                    "axisMode": "multi",
                    "dimensionAxis": {
                        "showAxis": true,
                        "showTitle": true,
                        "title": "",
                        "customSize": "auto",
                        "icons": {
                            "useIcons": false,
                            "iconProps": {
                                "column": "",
                                "fit": "cover",
                                "type": "round"
                            }
                        }
                    },
                    "measureAxis1": {
                        "sqrtScale": false,
                        "showAxis": true,
                        "customDomain": {
                            "showDomain": false
                        },
                        "showTitle": true,
                        "title": ""
                    },
                    "measureAxis2": {
                        "sqrtScale": false,
                        "showAxis": true,
                        "customDomain": {
                            "showDomain": false
                        },
                        "showTitle": true,
                        "title": ""
                    },
                    "legend": {
                        "show": true,
                        "showHeader": true,
                        "inside": false,
                        "descOrder": false,
                        "position": "right-top",
                        "customSize": "auto"
                    },
                    "tooltip": {
                        "customizeTooltip": false,
                        "showDimensions": true,
                        "dimensions": "",
                        "showMeasures": true,
                        "measures": "",
                        "showPercentage": true,
                        "showBinLabel": true
                    },
                    "trellis": {
                        "enable": false,
                        "showGridLines": true,
                        "flipLabels": false,
                        "type": "x",
                        "chartsPerLine": 4,
                        "size": [
                            100,
                            100
                        ]
                    },
                    "applyConditionalFormatting": true,
                    "exploreLink": true,
                    "columnMap": {
                        "trellis": [],
                        "plots": [
                            "sum_Amount"
                        ],
                        "dimensionAxis": [
                            "Industry"
                        ],
                        "split": [
                            "Product_Name"
                        ]
                    },
                    "normalize": false
                }
            }
        }
    },
    "datasets": [
        {
            "id": "0Fb6F000000GcpYSAS",
            "name": "DTC_Opportunity_SAMPLE",
            "url": "/services/data/v43.0/wave/datasets/0Fb6F000000GcpYSAS"
        }
    ]
}
Lidia Privantu 4Lidia Privantu 4
Thank you, fifedog15!
That was actually the solution for the next one.I couldn't pass that one either
Apparently the order matters. :)
akash_dev__cakash_dev__c
Hi All,

I was getting the same error again and again. Apparently the order matters.

Follow the steps in the order as they have been defined in the challenge... I have followed the same approach, instructions and as the result I have cleared the challenge...

steps: 

Dataset: DTC Opportunity
Chart Type: Stacked Bar
Bars: Industry
Bar Segments: Product Name
Bar Length: Sum of Amount
Sort: Descending
Filters: Product Family Laptops
Filters: Won true
Lens Name: Top Laptop Industry
App: My Exploration

follow these steps one by one and if you are having any pre added lenses in your My Exploration app then delete all of them and save the current lens and run the app. 

Below is the query: 

q = load "DTC_Opportunity_SAMPLE";
q = filter q by 'Product_Family' == "Laptops";
q = filter q by 'Won' == "true";
q = group q by ('Industry', 'Product_Name');
q = foreach q generate 'Industry' as 'Industry', 'Product_Name' as 'Product_Name', sum('Amount') as 'sum_Amount';
q = order q by 'sum_Amount' desc;
q = limit q 2000;

Thanks and Regards,
Akash Garg

Please like and share if I am able to help you with my answer.
Jason LanninJason Lannin
I had the same issue above and deleted all lenses and started again. This solved the problem!
Jyoti Gaur 16Jyoti Gaur 16
Hi All,

I also faced same issue and tried to solve it, but suddenly I read out the whole assignmnet one more time and found that the order of steps are most important.

I think If we follow ordering of the steps as it is mentioned in the challenge, it will resolve your problem.

Thanks.
Dylan SmithDylan Smith
Hi Othmane,
Be sure to do the steps in precise order. The challenge seems to rely on the tracking history feature of the Analytics Studio.

Best,
Dylan
Ranjeet BhoyarRanjeet Bhoyar
@Dyan Smith : Trailhead is not relying the tracking history. They are looking for the exact match of the query resulted from the lens.

Following are two different queries resulting same Lens visualisation

Query when you select Won as first filter and Product Family as Second filter

q = load "DTC_Opportunity_SAMPLE";
q = filter q by 'Won' == "true";
q = filter q by 'Product_Family' == "Laptops";
q = group q by ('Industry', 'Product_Name');
q = foreach q generate 'Industry' as 'Industry', 'Product_Name' as 'Product_Name', sum('Amount') as 'sum_Amount';
q = order q by 'sum_Amount' desc;
q = limit q 2000;

Query when you select Product Family as first filter and Won as Second filter

q = load "DTC_Opportunity_SAMPLE";
q = filter q by 'Product_Family' == "Laptops";
q = filter q by 'Won' == "true";
q = group q by ('Industry', 'Product_Name');
q = foreach q generate 'Industry' as 'Industry', 'Product_Name' as 'Product_Name', sum('Amount') as 'sum_Amount';
q = order q by 'sum_Amount' desc;
q = limit q 2000;

Second query is what trainlhead bots are expecting, Therefore, you may correct the sequence of the filters to pass the challange.

Please mark this as answer if this solves the issue.

Best Regards
Ranjeet Bhoyar
priyanka mane 6priyanka mane 6
I have successfully passed the challenge Please follow below order to pass trailhead successfully

1. Select bar Industry
2. Select second bar product name
3. Bar length sum amount
4. Arrange descending
5. add filter1 - product family = laptop
6. add filter2 - won = true
7. arrange stacked bar
8. save lense Top Laptop Industry
9. Add both description
10. add app : my exploration
11. save
Then check
Please hit like button if it solves purpose :)
Sanja Blomberg 12Sanja Blomberg 12
Yes, you must to follow the order of instruction to pass this challenge.
chakravarthi garikapati 1chakravarthi garikapati 1
Hi All,
Under Bar Length just delete "Count of Rows" now save it again and checkout the challenge.
Roger FernandoRoger Fernando
Hi All,

@fifedog15 I completely agree with you.
I would also like to add another bit of information to the steps. Please see the sort sequence!!

BUILD IN ORDER OF BULLET POINTS
Click on your Dataset: DTC Opportunity
Select Chart Type: Stacked Bar
Set Bars: Industry
Set Bar Segments: Product Name
Set Bar Length: Sum of Amount
Set Sort: Descending ( in the order of Industry, Product Name and finally Sum of Amount )
Set Filters: Product Family Laptops
Set Filters: Won true
Set Lens Name: Top Laptop Industry

Final chart should be as below!!
Save Lens into the App: My ExplorationUser-added image

Leave a like if this helped :)
Kiran Sattikar 13Kiran Sattikar 13
Don't try to work in query mode and chart mode together. The bot won't be able to check, seems defect. Just follow the sequence as mentioned
C LereverendC Lereverend
Got the same error code :

There was an unhandled exception. Please reference ID: YMDWHGUX. Error: Restforce::ResponseError. Message: 550: Lens State conversion has failed. Cannot open lens with SAQL in API version below 40.0

DTC Opportunity @AnalysticStudio
 
Maan HashemMaan Hashem
Thank you Fifedog15!  Your answer solved this issue.
Shri Ram ComputersShri Ram Computers
Thanks for sharing.. also know how to sell your old laptop for cash (https://www.shriramcomputers2001.com/laptop)