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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Measure with direct query

Hello, 

This is my first post, so bear with me.

I've got a azure SQL database (connected with direct query as I want to publish to the service) with source data similar to this: 

 

RegionMonthsalesforecasted sales
EU01-01-20202689.5412875.812
US01-01-20205028.1125401.079
Asia01-01-20208516.6688470.503
EU01-02-20209076.1848778.406
US01-02-20204269.9554103.235
Asia01-02-20208849.8098549.279
EU01-03-20205163.4914888.218
US01-03-2020683.7241725.5368
Asia01-03-2020713.021666.8129
EU01-04-2020 3696.9
US01-04-2020 3506.469
Asia01-04-2020 8734.434

I want to make a dashboard where I give the user a date slide and a region tickbox. After moving that around, he should be able to see the average sales and forecasted sales for all the selected regions and months. 

 

I managed to do this fine with an imported dataset from excel, publishing to the service went fine too. Solved with a measuer like this AVERAGEX(SUMMARIZE(Table; Table[Date];"TempDate";sum(Table[ForecastSales]));[TempDate]) (one each for sales and forecasts and a bunch of other columns).

 

Now the source is being migrated to an Azure SQL database. If I imported the data, I could keep everything more or less the same as in the "excel version". But it seems as if that could not be published to the service (not updating from Azure SQL). Direct Query options allow updates. 

 

I try the same measure in a direct query, it only includes the last date. I dont understand why. If I add the date filter (drag to the "Filters on this visual") and filter anything but the newest, I get "blank", and the average is only over the last date.

 

So there are two options to solve this

- I manage include data import from Azure SQL into PowerBi Service.

- Manage to make the measure run with the direct query. 

 

Could someone please help.

 

2 REPLIES 2
Icey
Community Support
Community Support

Hi @Anonymous ,

 

I don't have an Azure SQL Datebase account, so I use SQL Server to test. I think your measures work well on DirectQuery mode.

sales.gif

 

If I missed anything, please let me know.

 

 

Best Regards,

Icey

 

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

amitchandak
Super User
Super User

Direct Query do not support the calculated column and few visuals. If you are using column you need to convert them visuals

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.