Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello guys,
I've been searching from a week now and still didn't find anything that helped me with this one,
I want to have a vision of my batch numbers and the cost for each item,
Since Power BI's matrix visual has a column limit, I've created a table with 9 rows and ranked my batch numbers by date
If i slice the data by date I has to fill from left to right
The problem is it work only if has one rank from each item
PBIX file:
https://drive.google.com/file/d/1VJxuo9N6GpC8uexMlyk-e8cdDnMYG006/view?usp=sharing
Solved! Go to Solution.
Hi @WMansueto ,
Please try code as below to create [Cost] and [Batch] measures.
Cost =
VAR _SUMMARIZE =
SUMMARIZE (
ALLSELECTED ( Batches ),
Items[ItemName],
Batches[BatchNumber],
Batches[Cost],
"RANK", [Rank]
)
VAR _Costs =
SUMX (
FILTER (
_SUMMARIZE,
[ItemName] = MAX ( Items[ItemName] )
&& [RANK] = MAX ( 'Columns'[IdColumn] )
),
[Cost]
)
RETURN
IF ( _Costs = BLANK (), "error", _Costs )
Batch =
VAR _SUMMARIZE =
SUMMARIZE (
ALLSELECTED ( Batches ),
Items[ItemName],
Batches[BatchNumber],
Batches[Cost],
"RANK", [Rank]
)
VAR _BatchNumbers =
MAXX (
FILTER (
_SUMMARIZE,
[ItemName] = MAX ( Items[ItemName] )
&& [RANK] = MAX ( 'Columns'[IdColumn] )
),
[BatchNumber]
)
RETURN
IF ( _BatchNumbers = BLANK (), "error", _BatchNumbers )
Result is as below.
By Default:
With Date filter:
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
I think that it requires different approach to solve this kind of problem. I would go for calculated column in this specific case as you would like to return information not processing them.
I created calculated column in Batches calles Rank and instead of using measures I would depend on existing + calulated column. In aggregations it says First batch number but in fact it will be always the one you slice because matrix is operating on the lowest grain - there are no aggregations.
I attach PBIX.
https://drive.google.com/file/d/1TKXXNAb2xpZoDwMyG5unD_S7eSM0ndLI/view?usp=sharing
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: www.linkedin.com/in/lukasz-kozdron
This kind of work but I have to fill the left gaps,
And in my production dashboard i have 100+ batches and the matrix visual is limited to 100 columns,
So, i have to limit only 20 or 30 batches at time.
Hi @WMansueto ,
Please try code as below to create [Cost] and [Batch] measures.
Cost =
VAR _SUMMARIZE =
SUMMARIZE (
ALLSELECTED ( Batches ),
Items[ItemName],
Batches[BatchNumber],
Batches[Cost],
"RANK", [Rank]
)
VAR _Costs =
SUMX (
FILTER (
_SUMMARIZE,
[ItemName] = MAX ( Items[ItemName] )
&& [RANK] = MAX ( 'Columns'[IdColumn] )
),
[Cost]
)
RETURN
IF ( _Costs = BLANK (), "error", _Costs )
Batch =
VAR _SUMMARIZE =
SUMMARIZE (
ALLSELECTED ( Batches ),
Items[ItemName],
Batches[BatchNumber],
Batches[Cost],
"RANK", [Rank]
)
VAR _BatchNumbers =
MAXX (
FILTER (
_SUMMARIZE,
[ItemName] = MAX ( Items[ItemName] )
&& [RANK] = MAX ( 'Columns'[IdColumn] )
),
[BatchNumber]
)
RETURN
IF ( _BatchNumbers = BLANK (), "error", _BatchNumbers )
Result is as below.
By Default:
With Date filter:
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This works perfectly, thank you so much
If you rank them by date then why not include the date in the matrix?
User | Count |
---|---|
20 | |
18 | |
17 | |
11 | |
7 |
User | Count |
---|---|
29 | |
28 | |
13 | |
12 | |
12 |