The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I am writing a custom data connector using the Power Query SDK in Visual Studio. I have started to write unit tests as per this documentation: https://docs.microsoft.com/en-us/power-query/handlingunittesting . However, I am finding if I have two Facts that call the same function, but with different arguments, I get an error 'Information is needed in order to combine data' and the unit tests won't execute.
As an example, the following unit tests will execute correctly as I am calling the same thing twice:
shared MyExtension.UnitTest1= [ facts = { Fact( "Test1", 1, Table.RowCount(Data_Connector("Argument1", "Argument2")) ), Fact( "Test2", 1, Table.RowCount(Data_Connector("Argument1", "Argument2")) ) }, report = Facts.Summarize(facts) ][report];
However, the below will not, now that one of the arguments in the Data_Connector function is different:
shared MyExtension.UnitTest1= [ facts = { Fact( "Test1", 1, Table.RowCount(Data_Connector("Argument1", "Argument2")) ), Fact( "Test2", 5, Table.RowCount(Data_Connector("SomethingElse1", "SomethingElse2")) ) }, report = Facts.Summarize(facts) ][report];
Running the two tests manually in PowerBI returns the expected Table.RowCount results.
I have the latest version of Visual Studio and the Power Query SDK.
Any thoughts? It's doing my head in.
Hi,
Do I have to use Power BI to do unit testing for my project in Power Apps? Is there a way to directly connect Visual Studio's Power Query SDK with the project I created in Power Apps for unit testing? If so, could you provide relevant tutorials?
Thanks.
Hi @Anonymous ,
Do you get error when you run the code in Visual Studio or in Power BI ?
If it is convenient, could you share the screenshot of the error message so that I could understand better?
In addtion, maybe @ImkeF has other ideas.
Best Regards,
Cherry
Hi @v-piga-msft - I am getting the error code in Visual Studio when I go to 'run' my Data_Connector.query.pq file which contains the unit tests. Please see screenshot below:
This could be due to incompatible privacy settings. There are a lot of threads in this forum with similar problems, like this i.e.: https://community.powerbi.com/t5/Service/Refresh-error-message-Information-is-needed-in-order-to-com...
Please check out the options described there.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Thank you for your response @ImkeF. I have looked through the articles and tried the solutions (setting privacy levels to none) but to no avail.
It seems, according to this thread, that the issue is still quite prevalent in the latest version of Power BI Desktop. I will continue to monitor the thread for future resolutions.