I have the sample data below
I used the code below to get the result as below for measure.
CONCATENATEX(VALUES(Table[Type]),Table[Type],", ")
It worked for the table view. However, when I do the count in multi-row card, it won't work.
My desired outcome is something looks like below. Looking to have the view in Multi-row card to get the outcome like that. Please help!!! Either measure or column will be fine as long as it gives me the result.
The way you described it, you need a calculated column first
Column = CALCULATE(CONCATENATEX(VALUES('Table'[type]),'Table'[type],","), ALLEXCEPT('Table','Table'[id]))
Then you can create a measure to show the count
Measure =
COUNTX ( SUMMARIZE ( 'Table', 'Table'[id], 'Table'[Column] ), [Column] )
Related
I am trying to calculate the TotalFTE, but I can't figure it out. I am fairly new to DAX and trying to make the best of it with some studycases.
The table contains a lot of columns, but these are the columns that are needed for the measure.
The measure should sum the highest FTE in a year per ID and ignore the blanks in ID.
I've build a measure that gives an error when I try to visulise the result in a card. My measure: TotalFTE = CALCULATE(MAX(Table[FTE]), FILTER(Table, DISTINCT(Table[ID])))
Any feedback?
Moving forward, please post data as tables in stack and refrain from provide the data as image.
Measure =
SUMX (
GROUPBY (
'Fact',
'Fact'[year],
'Fact'[ID],
"#Max", MAXX ( CURRENTGROUP (), 'Fact'[FTE] )
),
[#Max]
)
I'm trying to remove filters from a calculated column with ALL(), and the measure seems to ignore it
"Class" is a calculated column.
I want to add measure always showing 100 (the grand total)
There are outer filters on the table so I don't want to use ALL(TABLE)
However, CALCULATE(SUM([Total Sales]), ALL(Product, Class)) doesn't work.
You can use the ALL() function on a list of columns like this:
CALCULATE ( SUM ( Table1[Sales] ), ALL ( Table1[Product], Table1[Class] ) )
This should work fine even if Class is a calculated column.
I want to calculate the RequiredMeasure column in DAX as shown in the below figure.
If I remove the Product SKU then the value should not change it should show the total values of RequiredMeasure as 200 only as shown in the below figure.
Please find the below screenshot for clear understanding.
SUMX is the function you need, to iterate over all rows of the table, and calculate an expression:
Required Measure =
SUMX (
Table1,
Table1[Net Revenue] * Table1[Total Measure]
)
Worked example file: https://pwrbi.com/so_55255241/
I built a diagram that displays the relative frequencies of my clusters (on the values in the column) and the cumulated frequencies (on the values on the line).
My chart has this aspect:
I would like to add a new column to the right that is equal to the sum of all the values of the previous columns.
The relative frequencies are created using the code below:
"Frequencies UL" :=
CALCULATE (
DISTINCTCOUNT ( 'table1'[Column1] );
USERELATIONSHIP ( 'Order Cluster'[Cluster Name]; table1[tag Cluster] );
SUMMARIZE ( table1; table1[tag Cluster] )
)
I would really appreciate some help!
Thanks
Simply it was necessary to do this:
"Frequencies UL" := IF(SELECTEDVALUE('Order Cluster'[Is Total]);
CALCULATE(DISTINCTCOUNT ('table1'[Column1]); ALL('Order Cluster')); DISTINCTCOUNT('table1'[Column1]))
And this is the result I got!
I'd suggest creating a new table to use for your x-axis.
If your 'Order Cluster' table looks like this:
ClusterName Order
ClusterA 1
ClusterB 2
... ...
ClusterZ 26
You want to add a Total row to the end so try something along these lines:
NewTable = UNION('Order Cluster', {("Total", MAX('Order Cluster'[Order]) + 1)})
Use NewTable[ClusterName] for your chart's x-axis and tweak your cumulative measure to reference NewTable[Order] in the FILTER inequality.
You'll also need to adjust your frequency measure to handle the case when you have the Total cluster (use an IF or SWITCH) and make sure you're evaluating within the correct filter context. Something like this logic:
IF( MAX( NewTable[ClusterName] ) = "Total",
CALCULATE( [Frequency Calc], ALLSELECTED( table1 ) ),
CALCULATE( [Frequency Calc],
FILTER(
ALLSELECTED( table1 ),
table1[tag Cluster] = MAX( NewTable[Order] )
)
)
)
P.S. You might be better off adding the total row to your 'Order Cluster' table in the query editor instead of having another table floating around. In any case, the logic is similar; add a total row to the column you're using for your axis and adjust your measures to handle that category how you want.
A waterfall chart might be another option to consider (and doesn't need nearly as much work), though I don't know that you can include the percent info except in the tooltip.
I've been struggling to find a way to achieve the result of a matrix visualization in Power BI, in a line and clustered column chart.
I have tried using ALLSELECTED, ALL, ALLEXCEPT in order to ignore one filter but no matter how I try it, I'm not reaching my end goal.
CarCountPerCategory =
CALCULATE(
DISTINCTCOUNT(Table[CarID]),
ALLSELECTED(Table[Filter])
)
This still breaks down the measure to the Filter level instead of ignoring it. I am looking for something that will give me the total distinct count regardless of the Filter column. E.g. TimesReshopped 1 - 190 on all 3 columns, TimesReshopped 2 - 182 on all 3 columns of the Filter Column series. I need this as a sidestep in order to divide the distinct car count to the total distinct car count per times reshopped in order to reach the percentage that I am looking for. (the one in the matrix)
Can someone help me with some advice? Thank you.
Try this:
[Total Category Count]:=
SUMX ( SUMMARIZE ( Table, Table[TimesReshopped] ), [Count of CarID] )
I got to the bottom of this by using ALLEXCEPT and providing all the filter that I was using:
CarCountPerCategory =
CALCULATE(
DISTINCTCOUNT(Table[CarID]),
ALLEXCEPT(Table,Table[Year],Table[Month],Table[LocationName],Table[CustCode],Table[TimeReshoped])
)