Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
21 | |
17 | |
16 | |
11 | |
7 |
User | Count |
---|---|
26 | |
25 | |
12 | |
12 | |
12 |