Forum Discussion
How to persist #sections document introspection variable in Power BI
Hi,
I would like to setup a series of parameters so that I can access them easily set their values in the Power BI service (for e.g. PBI Version="1.0.0.0", PBI Envrionment="Test", PBI Author="XXX" etc.)
I would like to dynamically display both parameter names and parameter values into for e.g. a multirow card in a PBI Report.
Now I can easily see them into Power Query using the #sections[Section1] in a Query but it seems such values are not persisted when loaded into the Power BI (the table in PBI is empty, it just shows the schema but without any row).
Any idea how to achieve this?
3 Replies
- FowmySuper User
Anonymous
You can create a measure for each value PBI Version="1.0.0.0", PBI Envrionment="Test", PBI Author="XXX" etc and they will be available for you to show on any visual.
Not sure If I understand your question 🙂- AnonymousNot applicable
Fowmy : thank you for your reply but the use case here is different.
I have a shared dataset and I need to setup a dev/ops pipeline that moves this dataset from one workspace to the other with powershell injecting as a parameter the correct Environment Version etc. Such values must be seen within the report so that people using the dataset knows his version etc.
I want to create a dynamic solution: a parser in power query (M) that scan/enlist all the parameters present in the file (I don't know in principle how many they are or their names) and print out in the report a list/table with param names and param values.
The code is this one but the values you see in power query are not loaded to power bi and cannot use in any visual because like I understand the variable #sessions "lives" only within power query and become blank as soon as you import in power bi (i.e. you press close & apply in power query).
let Source = Record.ToTable(#sections[Section1]), #"Filter Parameters" = Table.SelectRows(Source, each (Value.Is([Value], type text))) in #"Filter Parameters"
- ferryvResolver II
This response might be a bit late. I ended up creating a "lookup" table in PQ with the parameter info, similar to the below. Not ideal as it will not dynamically add/remove parameters when the list changes, but at least it refreshes the values when they are updated and they can be used in DAX.
let Source = Table.FromRecords({ [Name="Parameter name", Value = #"Parameter Name"], //reference to the parameter, [Name="another Parameter name", Value = #"Another Parameter Name"] //reference to the parameter
}) in SourceAnd then adding a DAX measure, e.g.
File Content Value = var parameterName = "Parameter Name" return LOOKUPVALUE(<tablename>[Value],<tablename>[Name],parameterName)
Replace <tablename> with the name of the query/table you're referencing.
Also documented here: https://www.linkedin.com/pulse/using-parameters-powerbi-ferry-van-der-vorst-6p1ee/