Hi I am new to Power BI.
I want to get parent name which based on parent code as table mention here.
I have manage to do that using duplicate table in model and perform join. But I need to do that using dax expression as new column. Appreciate your help here.
as table above I want to get parent name based on parent code.
eg.100 = A
Thank you
Use this expression in a calculated column
Parent Name =
LOOKUPVALUE(
'Table'[Name],'Table'[Code],
'Table'[ParentCode])
Related
I have one main data set for project list that contains "Project ID" columb and multiple child sets for different information for each project with "Project ID" and "Value" columns. Data sets connect via Project ID column. my bi publisher data model looks like this
My goal is to create table below.
the table I need to
When I use report editor of BI Publisher and apply following steps;
Insert a table
Add Project ID as first column from "main" data set.
Add Value columns from child data sets.
it worked perfectly fine and matched project id of every value and project id of main data set.
But I need to use excel templated but I cant get same table using excel template. I tried couple of repeating section combination, non of them work.
How do I connect child nodes to parent for each row?
Because of confidential reasons, I cant share screenshots and don't have any copy of template.
Thanks in advance.
Not sure how you have your data structure/XML set up. Or why you can't update the SQL on the dataset to combine the data there, but these may help:
Option 1
<?for-each:PROJECT?>
<?xdoxslt:set_variable($_XDOCTX, 'v_PROJECT', PROJECT_ID)?>
<?for-each:DATASET_1/RECORD?>
<?if:xdoxslt:get_variable($_XDOCTX,'v_PROJECT')=PROJECT_ID?>
<?VALUE?>
<?end if?>
<?end for-each?>
<?end for-each?>
Option 2
<?for-each:PROJECT?>
<?xdoxslt:set_variable($_XDOCTX, 'v_PROJECT', PROJECT_ID)?>
<?for-each:DATASET_1/RECORD[PROJECT_ID = xdoxslt:get_variable($_XDOCTX,'v_PROJECT')]?>
<?VALUE?>
<?end for-each?>
<?end for-each?>
Thank you for your help, I couldn't share any screen shot or code before because I didn't have any in my PC. But I setup BI Publisher to my PC and try to recreate sample data.
My data set
What I am trying to was creating a table like this
Table I want to create
This is my what xdo_metadata sheet looks like.
XDO_?XDOFIELD2? <?NAME?>
XDO_?XDOFIELD2? <?TASK_COUNT?>
XDO_?XDOFIELD3? <?TASK_COUNT?>
XDO_?XDOFIELD4? <?TASK_COUNT?>
XDO_GROUP_?XDOG1? <xsl:for-each select=".//PROJECT">
But it didnt work as I expected. It created a table like below
Output in first try
I found out why it didnt work, Beacuse I used same aliases for the all value columns.
Later I tried the change xdo_metadata with parent node before field names and it works perfectly fine;
XDO_?XDOFIELD2? <?NAME?>
XDO_?XDOFIELD2? <?./SET1/TASK_COUNT?>
XDO_?XDOFIELD3? <?./SET2/TASK_COUNT?>
XDO_?XDOFIELD4? <?./SET3/TASK_COUNT?>
XDO_GROUP_?XDOG1? <xsl:for-each select=".//PROJECT">
I guess using unique aliases in the each query like TASK_COUNT1,TASK_COUNT2,TASK_COUNT3 would work too.
I hope it will help those who will have problems in the future.
I'm using Office Script to generate a pivot table and that works. However, for my data hierarchy, I need "count" instead of the default "sum". How do I go about doing that?
I'm adding a hierarchy using the following - this works but summarizes by "sum"
pivotTable.addRowHierarchy(pivotTable.getHierarchy("Company"));
pivotTable.addDataHierarchy(pivotTable.getHierarchy("Unit ID"));
From the script reference page, I need to somehow embed the count function into the above snippet. Does anyone know how to do that? I tried "Record Actions", but it wasn't able to catch the switch from "sum" to "count".
Thanks a lot
Figured it out - to change the summarize function, we need to chain the aggregate function to the end of addDataHierarchy.
The second line in the previous example therefore becomes:
pivotTable.addDataHierarchy(pivotTable.getHierarchy("Unit ID")).setSummarizeBy(ExcelScript.AggregationFunction.count);
For more details refer to setSummarizeBy(summarizeBy).
I`m relatively new to MDX and any help would be much appreciated
I have a fact table containing information about items: Feature_Parent, Feature and User story. The Feature Parent is the Parent of the Feature and the Feature is the parent of the User Story, it looks something like this:
And as seen in the table it also contains info about the states of these items
This fact table also has numerical values and this table is connected to a similar dimension table
I also build the following user hierarchy:
I`ve managed to create the following pivot using Scopes in MDX (The Row labels are the Relationship hierarchy):
I want to be able to add the State for each item as one column (meaning, add the State column as the Measure in the above pivot), so it would display state for each item for each level
Can someone maybe help me in this?
This is the attribute hierarchy for the States (this is an example for Feature, and I have similar ones for Feature_Parent and User Story):
Any help would be much appreciated!
Thank you!
I have created a custom screen that records a "SalesPerson" ID that links back to the Salespersons records.
One of the requirements is to create an inquiry screen (not generic inquiry) that has a filter for the current sales person (based on logged in user). The Filters should be "All Records" / "My Items" with the second being the default displayed (based on the recorded "Sales Person)
For this, The PXSelect statement links {customtable} -> {employee} (where salesperson record = employee.salesperson
I even extended that to link employee.userId -> users.pKid.
The actual select statement is below:
public PXSelectJoin<CWAItem,
LeftJoin<EPEmployee,On<CWAItem.salesPersonID,Equal<EPEmployee.salesPersonID>>,
LeftJoin<Users, On<Users.pKID,Equal<EPEmployee.userID>>>>> MobileOrders;
Both of these correctly display the user name in the grid however when i create a filter where EPEmployee__UserID = #me or Users.UserName = #me no records are returned.
Scanning through the system this appears to be used on the "WZ201500" screen that has a simular filter. The difference that I see is this is referencing "EPEmployee_UserId" based on the table definition.
Is there a limitation to using child DAC's and the #me or is there a different way to handle the joins so the #me works correctly?
Any assistance would be appreciated.
Having not used #me I am not sure what this refers to, however we did something similar limiting records based on the current user ID using access info like such:
Where<EPEmployee.userID, Equal<Current<AccessInfo.userID>>
Hope that helps
Just use the Table AccessInfo then Default Value of your Filter Equals to AccessInfo.UserID to any of the Table Field you need like CreatedByID or ModifiedByID
Is there a way to modify MDS Excel Add-On saved XML query to work dynamically?
I'd like to filter results based on other linked entities.
I figured out the hardcoding way to change filter parameters for example [Group] IN ('1','2','3') but I can't get [Group] IN (SELECT Group FROM tbl WHERE x=y) to work.
Suggestions are highly appreciated!