- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

POWER BI DAX QUERY
Hello,
I have a table like
SLNORES1USERGROUP
1 | A | 1 | A |
1 | B | 2 | A |
1 | A | 3 | A |
1 | A | 4 | A |
1 | B | 5 | A |
1 | A | 6 | A |
1 | C | 7 | A |
1 | A | 8 | A |
2 | B | 9 | A |
2 | B | 10 | A |
2 | A | 11 | A |
2 | B | 12 | A |
2 | B | 13 | A |
2 | A | 14 | A |
2 | C | 15 | A |
3 | C | 16 | A |
3 | A | 17 | A |
3 | C | 18 | A |
3 | C | 19 | A |
1 | A | 20 | B |
1 | A | 21 | B |
1 | C | 22 | B |
1 | A | 23 | B |
and I created a measure which calculate the max count value of USER , SLNO wise and GROUP Wise
i.e
and i want to calculate the 2nd max value for each SLNO; GROUP Wise
My Required table is like
GROUP | SLNO | T@MAX%VAL | T@MAX2%VAL |
A | 1 | 5 | 2 |
B | 1 | 3 | 1 |
A | 2 | 4 | 2 |
A | 3 | 3 | 1 |
i want to use measures for the whole calculations
and there should be slicers of group to check the result
Thanks & Regards...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi, @BIswajit_Das
May I ask if this is the expected output you are looking for? Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.
Measures:
MAXCOUNT =
VAR _max_count =
MAXX (
SUMMARIZE ( 'Table', 'Table'[RES1], "count", COUNTROWS ( 'Table' ) ),
[count]
)
RETURN
_max_count
SECONDMAXCOUNT =
VAR _max_count =
MAXX (
SUMMARIZE ( 'Table', 'Table'[RES1], "count", COUNTROWS ( 'Table' ) ),
[count]
)
VAR _value =
MAXX (
FILTER (
SUMMARIZE ( 'Table', 'Table'[RES1], "@count", COUNTROWS ( 'Table' ) ),
[@count] = _max_count
),
'Table'[RES1]
)
VAR _sec_max_count =
MAXX (
FILTER (
SUMMARIZE ( 'Table', 'Table'[RES1], "count2", COUNTROWS ( 'Table' ) ),
'Table'[RES1] <> _value
),
[count2]
)
RETURN
_sec_max_count
If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi, @BIswajit_Das
May I ask if this is the expected output you are looking for? Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.
Measures:
MAXCOUNT =
VAR _max_count =
MAXX (
SUMMARIZE ( 'Table', 'Table'[RES1], "count", COUNTROWS ( 'Table' ) ),
[count]
)
RETURN
_max_count
SECONDMAXCOUNT =
VAR _max_count =
MAXX (
SUMMARIZE ( 'Table', 'Table'[RES1], "count", COUNTROWS ( 'Table' ) ),
[count]
)
VAR _value =
MAXX (
FILTER (
SUMMARIZE ( 'Table', 'Table'[RES1], "@count", COUNTROWS ( 'Table' ) ),
[@count] = _max_count
),
'Table'[RES1]
)
VAR _sec_max_count =
MAXX (
FILTER (
SUMMARIZE ( 'Table', 'Table'[RES1], "count2", COUNTROWS ( 'Table' ) ),
'Table'[RES1] <> _value
),
[count2]
)
RETURN
_sec_max_count
If this does not work, could you please share some sample data without sensitive information and expected output.
How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
06-05-2023 05:09 AM | |||
11-29-2024 03:07 AM | |||
05-16-2024 08:36 AM | |||
05-12-2024 10:05 PM | |||
04-25-2024 09:25 AM |
User | Count |
---|---|
128 | |
100 | |
85 | |
52 | |
46 |