March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
HI,
can someone advice how can i get the result... I want to sort the share holder name which maximum date (3/11/2022) are showing the higher shareholding value than minimum date (2/9/2022). if let say the DAX code requires hope some one can help.Thank You
Solved! Go to Solution.
You can create a new table with the code below:
Hi @Anonymous ,
Do you want to get the rows which the value with maximum date is higher than the one on minimum date, right? If yes, I created a sample pbix file(see attachment) for you, please check whether that is what you want.
1. Create a measure as below:
Flag =
VAR _selholder =
SELECTEDVALUE ( 'Table'[Holder_Name] )
VAR _seldate =
SELECTEDVALUE ( 'Table'[Date] )
VAR _mindate =
CALCULATE (
MIN ( 'Table'[Date] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Holder_Name] = _selholder )
)
VAR _maxdate =
CALCULATE (
MAX ( 'Table'[Date] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Holder_Name] = _selholder )
)
VAR _mindvalue =
CALCULATE (
SUM ( 'Table'[Sum Shareholding] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Holder_Name] = _selholder
&& 'Table'[Date] = _mindate
)
)
VAR _maxdvalue =
CALCULATE (
SUM ( 'Table'[Sum Shareholding] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Holder_Name] = _selholder
&& 'Table'[Date] = _maxdate
)
)
RETURN
IF ( _maxdvalue >= _mindvalue && _seldate = _maxdate, 1, 0 )
2. Create a table visual and apply the visual-level filter with the condition(Flag is 1)
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
You can create a new table with the code below:
the result showing error 😅. btw TQVM
// measure 1
[Date with Highest Value] =
// Works even if there are many
// companies visible. It'll then
// return the date for which the
// value is the highest among all
// the values visible for the selected
// companies. If one company is visible,
// you get what you've asked for. If
// you don't want this behaviour, you can
// always wrap this into an IF conditional
// logic.
var Output =
MAXX(
topn(
1,
T,
// The combination of these three fields
// should be unique. Then this function
// will return at most 1 row.
T[Sum Shareholding],
desc,
T[Date],
desc,
T[Holder_Name],
asc
),
T[Date]
)
return
Output
// measure 2
[Total Sum Shareholding] =
var Output =
SUMX(
topn(
1,
T,
T[Sum Shareholding],
desc,
T[Date],
desc,
T[Holder_Name],
asc
),
T[Sum Shareholding]
)
return
Output
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
16 | |
16 | |
12 |