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

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.

Reply
trevb
Resolver I
Resolver I

Best way to provide a single scalar piece of information query or function

I have a number of projects in a database and queries based all around this.

 

As part of those queries I have the concept of EarliestProject and LatestProject.  At this point in time these are provided by a query that pretty much contains just this.

 

MinDate = List.Min(CoreDataQuery[ProjectStartDate])

 

Now this works and I can just refer to it as EarliestDate in the other queries and it is good.  The downside though is that it shows a one field query to the base data users.  They should not need to see this.

 

In other areas I use Parameters, but these are not dynamic so cannot work for me above.  I hit on the idea of a single Parameter table that carries a number of these.  i.e. I can build a table with "Name","Value" where Name=EarliestProject and value = List.Min(CoreDataQuery[ProjectStartDate]).  Ideally I'd like to then access this still using a VariableReplacement name i.e.

 

if [CurrentDate] < EarliestDate then.....

 

The above forces me to something more like

 

if [CurrentDate] < Table.SelectRows(ParameterData, each (Values[Name] = ""Earliest Project"")){0}[Value]

 

To solve this I decided I would create a Power Query function something like

 

FunctionName () =>   blah blah........

 

I could not get the syntax to resolve though and I suspect that you cannot create a parameterless function.  Is that right?  and if so what is the best way to build these uber variables?  I could obviously create a function like  GetParameter("EarliestProject") which would be quite flexible but still a little less clean.  How do other people organise things like this?

 

 

2 REPLIES 2
KGrice
Memorable Member
Memorable Member

If your main concern is showing the one-field query to the end users, you can just hide it. Go to the Data pane on the left side (where you've got three icons for Report, Data, and Relationships). In the Data window, you can right-click the table on the right under Fields and select Hide in Report View.

 

As an alternative, you can also select the table so that it shows in the main window, then right-click individual columns and choose Hide in Report View to hide only the specific columns. If you hide all of the columns individually, this will also hide the entire table in the Report view.

I'm really more concerned about having a single source of the data but with multiple audiences for that data.  Templates doesn't really cut it as it means publishing different datasets fro the different audiences.   The audiences don't tend to use the data directly so what I really need is a different front end to the same data.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.