I'm trying to create a measure that re-calculates the rank in the power pivot table everytime the user deselects a value or changes the group by row labels. For example, per table below, there are 3 companies rates per quote id with their respective rank in each quote.
Is there a measure that can recalulcate the rank of each company's rate per quote id if the user deselects company B so that power pivot table would look like this:
Also, can the same measure also recalculate the rank by averaging the rank of each quote id if the user removed quote id from the row labels for the power pivot table so that power pivot table would look like this:
Any help appreciated.
Ranking =
IF (
ISFILTERED ( Quotes[Quote] ),
RANKX ( FILTER ( ALLSELECTED ( Quotes[Company] ), [Rate Total] ), [Rate Total],, ASC ),
AVERAGEX (
VALUES ( Quotes[Quote] ),
RANKX ( FILTER ( ALLSELECTED ( Quotes[Company] ), [Rate Total] ), [Rate Total],, ASC )
)
)
Related
Inventory summary is an excel workbook that was imported. I have a Calendar table and I have Inventory Summary.date linked.
Hardware Inventory Prior Month =
CALCULATE (
SUM ( 'Inventory Summary xls'[Value] ),
FILTER (
'Inventory Summary xls',
'Inventory Summary xls'[Description] = "Hardware"
),
DATEADD ( 'Inventory Summary xls'[Date], -1, MONTH )
)
Your code seems ok. Are you sure you did the modeling correct?
Also please check that your date table is marked as date table. Go to Data View --> Table tools --> Calendars --> Mark as Date Table see picture:
Note: Write your filter argument like this:(Iterate only what you need! not the whole fact table :))
Hardware Inventory Prior Month =
CALCULATE (
SUM ( 'Inventory Summary xls'[Value] ),
FILTER (
ALL ( 'Inventory Summary xls'[Description] ),
'Inventory Summary xls'[Description] = "Hardware"
),
DATEADD ( 'Inventory Summary xls'[Date], -1, MONTH )
)
Given this table bellow:
In Excel, when I insert a pivot table, the column 'id' has being calculated to a total sum
Clearly, it is not needed
Any thoughts of how can I remove the aggregation from this column alone and keep the same current appearance of the table ( same but without caculating id_1+id2...+idn)
Create this measure:
MyID :=
VAR ThisName =
MIN( Table1[Name] )
RETURN
IF(
HASONEVALUE( Table1[Name] ),
CALCULATE( MIN( Table1[ID] ), Table1[Name] = ThisName ),
BLANK()
)
amending table/column names where required.
You can then drag this measure into the Pivot Table Values area.
I have a table of Name, date (every day of the year), and hours. I am trying to create a pivot table to analyze the compliance of the data. By that I mean, I need to know for every year how many people are complainant with the 1800 limit (sum of all hours for the year) and how many are not.
i created the required results via 4 tables see image but because i am using so many table, i am unable to do any drilldown/drill up analyzes. Is there a way to combine all of this in one table?
Add your Pivot Table to the Data Model and then create three new measures:
CompliantCheck :=
IF (
ISFILTERED ( Table1[Name] ),
IF ( SUM ( Table1[Hours] ) > 1800, "Non-Compliant", "Compliant" ),
""
)
CompliantCount :=
IF (
[CompliantCheck] = "",
"",
0
+ CALCULATE (
DISTINCTCOUNT ( [Name] ),
FILTER ( ALL ( Table1[Name] ), [CompliantCheck] = "Compliant" )
)
)
NonCompliantCount :=
IF (
[CompliantCheck] = "",
"",
0
+ CALCULATE (
DISTINCTCOUNT ( [Name] ),
FILTER ( ALL ( Table1[Name] ), [CompliantCheck] = "Non-Compliant" )
)
)
Obviously change the names of the table and fields in the above if necessary. Your Pivot Table should then comprise:
Rows: Name and Fiscal Year
Values: Sum of Hours, Compliant Check, CompliantCount, NonCompliantCount
I am struggling with a "simple" function that is killing me. I am simply trying to get the subtotal of each group in a pivot table. I d like to compute the percentage of each subgroup as my input data are wrong. It seems I cannot do the classic EARLIER, and there is no this or current or whatever...
CALCULATE (
SUM ( table1[numbers] ),
FILTER (
ALL ( table1 ),
table1[Names] = FIRSTNONBLANK ( ALL ( table1[Names] ), tables[Names] )
)
)
Thanks
Found it! Absolutely counterintuitive to me, but it works...
=CALCULATE (
SUM ( table1[numbers] ),
ALLEXCEPT ( table1, table1[Names])
)
I have to perform a task in power BI (DAX) where i have a list of users and their fields of work.
I have to combine all the fields corresponding to every user and find the highest frequency combination.
Below is how I was planning to do it.
How can i generate the "Expected Result" from the "Sample" file?
Sample:
ID Value
a medicine
b automobile
c banking
d scientist
a banking
a scientist
d banking
Expected Result:
ID Value Combi
a medicine|banking|scientist
b automobile
c banking
d scientist|banking
You can concatenate values from multiple rows and generate a delimited string by using CONCATENATEX() DAX function. Then use ADDCOLUMNS and SUMMARIZE to get the desired result.
Expected Table =
SUMMARIZE (
ADDCOLUMNS (
'Table',
"Combined Value", CONCATENATEX (
FILTER (
SUMMARIZE ( 'Table', 'Table'[ID], [Value] ),
[ID] = EARLIER ( 'Table'[ID] )
),
'Table'[Value],
"|"
)
),
[ID],
[Combined Value]
)
It produces:
Break down the logic
The easiest way in my opinion is create a calculated column in your table to generate the combined value column:
Combined Value =
CONCATENATEX (
FILTER (
SUMMARIZE ( 'Table', 'Table'[ID], [Value] ),
[ID] = EARLIER ( 'Table'[ID] )
),
'Table'[Value],
"|"
)
Then you can create a summarized table based on your table with the previously created calculated column. To create a calculated table go to the Modeling tab and click the New Table icon.
Use this expression:
Resumed Table =
SUMMARIZE ( 'Table', [ID], 'Table'[Combined Value] )
You will get a table like this:
While both methods work just fine, the recommend way to approach this issue is directly from Power Query or from your source.
Let me know if this helps.