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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
stuntmanpatch
Regular Visitor

Needing some help with how to build this table. Custom Columns.

I am struggling with a solution for this challenge, hoping for some inputs.  I'm trying to build a new table that consolidates the rows down to the uniques Names, then custom column to pull in the data.

The table is on the left.  It is a single table.

On the right is what I am trying to get to.  P4 is the gold standard that I want to compare any other PIDs values.

It's an audit tool that when I select the PID on the table this table on the right should filter down to Column A being the unique Name, column B being that chosen PIDS values, and column B being the gold standard value.

I hope that all makes sense and thank you in advance for any guidance

 

stuntmanpatch_3-1752849190064.png

 

 

1 ACCEPTED SOLUTION

This something like this what you are looking for?

jgeddes_0-1753464928959.png

let
    defaultPID = "25416",
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwVNJRCk4tKcnMSwcxI5ViddCEjbALGwOZfpjCJkiqTVHN9sMUNsIubIzdEBO4aiNTE0MzbC5HkzDCpcMYlw6oHbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [PID = _t, Name = _t, Enabled = _t]),
    set_types = 
    Table.TransformColumnTypes(
        Source,
        {
            {"PID", Int64.Type}, 
            {"Name", type text}, 
            {"Enabled", type text}
        }
    ),
    defaultTable = 
    Table.SelectRows(Source, each [PID] = defaultPID),
    merge_tables = 
    Table.NestedJoin(
        Source, 
        {"Name"}, 
        defaultTable, 
        {"Name"}, 
        "Source", 
        JoinKind.LeftOuter
    ),
    expand_default_enabled = 
    Table.ExpandTableColumn(
        merge_tables, 
        "Source", 
        {"Enabled"}, 
        {"DefaultEnabled"}
    ),
    sort_table = 
    Table.Buffer(
        Table.Sort(
            expand_default_enabled,
            {
                {"PID", Order.Ascending}, 
                {"Name", Order.Ascending}
            }
        )
    )
in
    sort_table




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

11 REPLIES 11
stuntmanpatch
Regular Visitor

Apologies if my description is vague.  I am learning as I go and it's difficult for me to formalize the problem.  I'll take another stab.  The posts thus far have gotten me close.

 

I have a single table that includes settings for various PIDS.

The settings that are in PID 25416 are considered the default settings.  Ultimatley, I am trying to put a table or display that would compare the settings say from PID 101 or PID 105, to the setting values in PID 25416.

The new column should return the respective value for PID 25416, for the respective Name, ie, setting 1, 2, etc.

Then I'm thinking in a display I can show these columns side by side to do a quick audit from any PID to the default values.

 

I've gotten to this point.  The isse with the below is that I do not know how to do the dynamic piece to pull in the relative value based on the Name.  

As in the below, I am pull in the respective value, but it is the value for Setting1 across the board.

What can i do to make the below pull in the value for the respective Name.

[Name] = [Name]  does not work.

Hope this makes it a little more clear.

Thank you all for the inputs.

 

 

let
Source = Prod_Custom_Toggle_Config,
AMB = 25416,
#"Added Custom" = Table.AddColumn(Source, "StandardAMB", each List.Max(Table.SelectRows(Source, each AMB = [PID] and [Name]= "Setting1")[IsEnabled]))
in
#"Added Custom"

 

stuntmanpatch_1-1753449634352.png

 

 

This something like this what you are looking for?

jgeddes_0-1753464928959.png

let
    defaultPID = "25416",
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwVNJRCk4tKcnMSwcxI5ViddCEjbALGwOZfpjCJkiqTVHN9sMUNsIubIzdEBO4aiNTE0MzbC5HkzDCpcMYlw6oHbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [PID = _t, Name = _t, Enabled = _t]),
    set_types = 
    Table.TransformColumnTypes(
        Source,
        {
            {"PID", Int64.Type}, 
            {"Name", type text}, 
            {"Enabled", type text}
        }
    ),
    defaultTable = 
    Table.SelectRows(Source, each [PID] = defaultPID),
    merge_tables = 
    Table.NestedJoin(
        Source, 
        {"Name"}, 
        defaultTable, 
        {"Name"}, 
        "Source", 
        JoinKind.LeftOuter
    ),
    expand_default_enabled = 
    Table.ExpandTableColumn(
        merge_tables, 
        "Source", 
        {"Enabled"}, 
        {"DefaultEnabled"}
    ),
    sort_table = 
    Table.Buffer(
        Table.Sort(
            expand_default_enabled,
            {
                {"PID", Order.Ascending}, 
                {"Name", Order.Ascending}
            }
        )
    )
in
    sort_table




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @jgeddes,  You helped me a lot with your solution you added.  It works great.  I'm hoping I can expand the requirement a little.  The code you shared assumed that defaultPID was a fixed 25416.

What if I had 3 options , 25416, 25418, 25420.
The user will select in the display one of the above.  Is is even possible to have the table column dynamically update based on which option the user selected.

The PID is a variable.  Technically, I guess I can add 3 new custom columns, one for each PID but I don't think that would force me to have to include more columns in the display that I am trying to avoid.

Thank you for any insights.

You can modify the Power Query code to allow for user selection but if you were to allow your users to pick a PID option from a list in report view they would have to be able to refresh the report in order for the Power Query to update.
That is not usually an option for most reports so you may be able to recreate the solution in DAX so it can exist in the report view without needing to refresh the dataset with each option selection.
One way to do this in DAX would be to create another table that contains the PID options. (25416, 25418, 25420 - make sure the data type matches the type in the original table).

You can then use the selected value of the new table in a measure that mimics the Power Query code. 
Here is an example of DAX code that does this...

_DefaultEnabled = 
var _rTable = 
SELECTCOLUMNS(
    FILTER(
        all(Query1),
        [PID] = SELECTEDVALUE('Table'[PID])
    ),
    "Name", [Name],
    "Enabled", [Enabled]
)
var _lTable = 
SELECTCOLUMNS(
    Query1,
    "PID", [PID],
    "Name", [Name]
)
var _jTable = 
NATURALLEFTOUTERJOIN(_lTable, _rTable)
RETURN
MINX(_jTable,[Enabled])

NOTE: Table[PID] is the new table created with the PID options.

jgeddes_2-1755528991803.png

jgeddes_3-1755529024652.pngjgeddes_4-1755529037727.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@jgeddes

Thank you for all your help.  I've been trying to solve for this one last item but cannot seem to get it right.  I was able to replicate your setup and that helped a ton.  I am able to choose one of the model PIDs and the _defaultenabled column will update accordingly.

Ultimately, I'm hoping to compare one PID on the left against one of the model PIDs.
The piece I cannot figure out is now how can I select a PID on the left to compare against.

An option to select say PID 105, and have it filter down to PID 105 compared against PID 25418 in the _defaultenabled column. 

I think I know the problem, just can seem to get it right.  If I put a PID Slicer from the full table, anything I select will blank out the compare table.  I'm guessing because we're explicitly filtering on a PID.  Or, another way, trying to filter based on two PIDs.   I've been trying to edit interactions but not getting anywhere.

Is is possible now to add another PID filter for all the PIDs so that a user can choose the PID, then choose the model PID, and see the display as one against the other.

For context, there are over 2000 PIDs, 3 Model PIDs, and 177 Settings, making this a really large display.

I appreciate your help a ton...

 

 

 

stuntmanpatch_0-1759410199716.png

 

To do this you would need two separate tables for slicing PIDs. The table for selecting the default PID should not be related to the main table. The table for selecting the comparison PID can be related to the main table. 

jgeddes_0-1759412419993.png

jgeddes_1-1759412443479.pngjgeddes_2-1759412474639.png

 

I attached a pbix file with this example model.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Thank you!!! @jgeddes That did the trick.  My err was trying to associate the new Default PID table to the matrix.  Once I pulled out that mapping it all flows as expected.  Thanks again.

v-menakakota
Community Support
Community Support

Hi  @stuntmanpatch  ,
Thanks for reaching out to the Microsoft fabric community forum. 

I would also take a moment to thank  @speedramps  , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference. 
I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.

Best Regards,
Community Support Team

Omid_Motamedise
Super User
Super User

Could you please provide the sample data as a table here?

 

 

If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h
Riny_vE
Frequent Visitor

Let's assume a set-up in Excel as shown below. Table1 contains your data, selection is a named range for the selected PID.

Riny_vE_0-1752991700526.png

 

The following M-code will generate the PQ result table:

 

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Filtered Rows" = Table.SelectRows(Source, each [PID] = selection or [PID] = "P4"),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Filtered Rows", {{"PID", type text}}, "en-001"), List.Distinct(Table.TransformColumnTypes(#"Filtered Rows", {{"PID", type text}}, "en-001")[PID]), "PID", "Enabled")
in
#"Pivoted Column"

 

where selection is a parameter based on the named range.

let
Source = Excel.CurrentWorkbook(){[Name="selection"]}[Content],
Column1 = Source{0}[Column1]
in
Column1

 

speedramps
Super User
Super User

I want to help you but your description is too vague. Please write it again.

How do you want to derive "Enabled for PID" in the right hand table?

For example 
PHD2 Name 1 = Y  and  PHD3 Name 2 = Y  and Enabled for PID = Y
PHD2 Name 2 = N  but  PHD3 Name 2 = Y  and Enabled for PID = N   why ???
PHD2 Name 3 = N  but  PHD3 Name 3 = Y  and Enabled for PID = N   why ???

 

Will there only every be one instance of P4 for each Name ?

If there are multiple instances then how should Enanable for PD be derived

 

speedramps_0-1752857317401.png


You will get a quicker and better response without misunderstandings if you put time and effort into carefully writing a clear problem description with example input and output data. Look forward to helping you when this information is forthcoming


* Please DON'T copy & paste your DAX that does not work and expect us to fathom what you want.
* Please DO give a simple non-technical functional description of what you want
* Keep it simple and break large projects into smaller questions and ask just one question per ticket.
* Rename columns to user friendly names. Avoid your own system jargon that we may not understand.
* Most importantly please provide example input data as table text (not a screen print) so helpers can import the data to build a solution for you. (Learn how to share data below)
* Provide the example desired output, with a clear step-by-step description of calculations and the process flow.
* Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
* Remove any unneeded tables, rows or columns which may cause confusion. Keep it short and concise with the minimal information regarding the key problem.
* Remember not to share private data ... we don't want you to get into trouble. ‌‌
* Please click the thumbs up button for these helpful hints and tips. Thank you.


Learn how to attach data in the forum using OneDrive:-
* Save your file in a OneDrive folder
* Right click on the file and click the “Share” blue cloud icon
* Click the bottom “Copy” button
* Click” Anyone with link can edit”
* Click “Can Edit”
* Click “Can View”
* Click “Apply” button
* Click “Copy”
* Paste the generated link via the forum, email, chat, or any other method.
* Helpers can then download your data, build a solution and share it back.


Learn how to attach data in the forum using Dropbox:-
1. Open Dropbox: Access the Dropbox folder on your computer or through the Dropbox web interface.
2. Select File/Folder: Find the file or folder you want to share.
3. Click Share (or Get Link): Look for a "Share" option or a similar "Get Link" option.
4. Choose Permissions: Decide whether to allow "view only" or "view and download" access.
5. Copy and Share: Copy the generated link and share it with anyone via the forum, email, chat, or any other method.

 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors