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.
We have two input tables and I want to return a grid as shown below. The tables are related based on the Product column via one to many relationship. The year corresponds to the maximum sales sum for an Asset.
Example : for A1 the max sales sum is 90 so the year corresponding to that is 2022
Solved! Go to Solution.
Hi,
Sorry for the mistake.
Please kindly check the below whether it suits your requirement.
Year of max sales sum: =
VAR _maxsales =
MAXX ( SUMMARIZE ( Table2, Table2[Year], Table2[Sales] ), Table2[Sales] )
VAR _maxsalesyear =
FILTER (
SUMMARIZE ( Table2, Table2[Year], Table2[Sales] ),
Table2[Sales] = _maxsales
)
RETURN
IF ( HASONEVALUE ( Table1[Asset] ), MAXX ( _maxsalesyear, Table2[Year] ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
Please check the below picture and the attached pbix file.
Year of max sales sum: =
VAR _newtable =
ADDCOLUMNS (
DISTINCT ( Table2[Year] ),
"@salessum", CALCULATE ( SUM ( Table2[Sales] ) )
)
VAR _maxsales =
GROUPBY (
_newtable,
Table2[Year],
"@maxsales", MAXX ( CURRENTGROUP (), [@salessum] )
)
RETURN
IF ( HASONEVALUE ( Table1[Asset] ), MAXX ( _maxsales, Table2[Year] ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Thanks! But this not render the correct result for A1, it should be 2022
Hi,
Sorry for the mistake.
Please kindly check the below whether it suits your requirement.
Year of max sales sum: =
VAR _maxsales =
MAXX ( SUMMARIZE ( Table2, Table2[Year], Table2[Sales] ), Table2[Sales] )
VAR _maxsalesyear =
FILTER (
SUMMARIZE ( Table2, Table2[Year], Table2[Sales] ),
Table2[Sales] = _maxsales
)
RETURN
IF ( HASONEVALUE ( Table1[Asset] ), MAXX ( _maxsalesyear, Table2[Year] ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
21 | |
15 | |
15 | |
11 | |
7 |
User | Count |
---|---|
25 | |
24 | |
12 | |
12 | |
11 |