Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a table , where I want max month name where AL=CL=CU
In this example September is the month which I want, regardless of any department
Department | Months | AC | CL | CU |
2 | February | 105 | 105 | 105 |
2 | March | 245 | 245 | 245 |
2 | April | 500 | 500 | 500 |
2 | May | 745 | 745 | 745 |
2 | June | 990 | 990 | 990 |
2 | July | 1050 | 1050 | 1050 |
2 | August | 2000 | 2000 | 2000 |
2 | September | 2100 | 2100 | 2100 |
2 | October | 2560 | 2343 | 2560 |
2 | November | 3400 | 3566 | 3045 |
2 | December | 4600 | 3789 | 4786 |
2 | January | 5000 | 4678 | 5678 |
40 | February | 105 | 105 | 105 |
40 | March | 245 | 245 | 245 |
40 | April | 500 | 500 | 500 |
40 | May | 745 | 745 | 745 |
40 | June | 990 | 990 | 990 |
40 | July | 1050 | 1050 | 1050 |
40 | August | 2000 | 2000 | 2000 |
40 | September | 2100 | 2100 | 2100 |
40 | October | 2560 | 2343 | 2560 |
40 | November | 3400 | 3566 | 3045 |
40 | December | 4600 | 3789 | 4786 |
40 | January | 5000 | 4678 | 5678 |
Can anyone please help me with this? as I am not able to get the max month like this anyhow.
Solved! Go to Solution.
pls try this
Measure =
VAR tbl=ADDCOLUMNS('Table',"check",if('Table'[AC]='Table'[CL]&&'Table'[AC]='Table'[CU],1,0))
return FORMAT(maxx(FILTER(tbl,[check]=1),'Table'[Months]),"mmmm")
Proud to be a Super User!
pls try this
Measure =
VAR _tbl = TOPN(1,
SELECTCOLUMNS(
FILTER(
ADDCOLUMNS(
'Table',
"Flag", INT( MIN( CALCULATE( MIN( 'Table'[AC] ) ), CALCULATE( MIN( 'Table'[CL] ) ) ) = CALCULATE( MIN( 'Table'[CU] ) ) )
),
[Flag] = 1
),
"@Month", 'Table'[Months],
"@AC", 'Table'[AC]
),ABS([@AC]))
RETURN
MAXX(_tbl,[@Month])
HI @Ahmedx , @ryan_mayu
If we want to create measure for same on negative numbers and for each department, how can we do that , I am not able to figure that out. Here is a sample data.
Department | Months | AC | CL | CU |
2 | January | 5000 | 4678 | 5678 |
2 | December | 4600 | 3789 | 4786 |
2 | November | 3400 | 3566 | 3045 |
2 | October | 2560 | 2343 | 2560 |
2 | September | 2100 | 2100 | 2100 |
2 | August | 2000 | 2000 | 2000 |
2 | July | 1050 | 1050 | 1050 |
2 | June | 990 | 990 | 990 |
2 | May | 745 | 745 | 745 |
2 | April | 500 | 500 | 500 |
2 | March | 245 | 245 | 245 |
2 | February | 105 | 105 | 105 |
46 | February | -1 | -1 | -1 |
46 | March | -2 | -2 | -2 |
46 | April | -3 | -3 | -3 |
46 | May | -4 | -4 | -4 |
46 | June | -5 | -5 | -5 |
46 | July | -6 | -6 | -6 |
46 | August | -7 | -7 | -7 |
46 | September | -8 | -8 | -8 |
46 | October | -9 | -10 | -11 |
46 | November | -10 | -12 | -13 |
46 | December | -14 | -17 | -15 |
46 | January | -20 | -16 | -15 |
and the result should be different, not September?
yes, depends on data, for negative right now it is september only, as max value works differently in negative right?
HI @Ahmedx
Suppose for this department , last matching values are -8 for september month, while using you query, it will show february, but I want september
as in negative value we would want minimum value instead of maximum value.
pls try this
Measure =
VAR _tbl = TOPN(1,
SELECTCOLUMNS(
FILTER(
ADDCOLUMNS(
'Table',
"Flag", INT( MIN( CALCULATE( MIN( 'Table'[AC] ) ), CALCULATE( MIN( 'Table'[CL] ) ) ) = CALCULATE( MIN( 'Table'[CU] ) ) )
),
[Flag] = 1
),
"@Month", 'Table'[Months],
"@AC", 'Table'[AC]
),ABS([@AC]))
RETURN
MAXX(_tbl,[@Month])
Hi,
Do you have a year column as well? If yes, then please share the dataset with that column.
There is not year column, but I got the solution from @ryan_mayu . Thanks for the help.
pls try this
Measure =
VAR tbl=ADDCOLUMNS('Table',"check",if('Table'[AC]='Table'[CL]&&'Table'[AC]='Table'[CU],1,0))
return FORMAT(maxx(FILTER(tbl,[check]=1),'Table'[Months]),"mmmm")
Proud to be a Super User!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
56 | |
55 | |
54 | |
37 | |
29 |
User | Count |
---|---|
77 | |
62 | |
45 | |
40 | |
40 |