Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Applicable88
Impactful Individual
Impactful Individual

Show Max Value of a column for the current month

Hello,

I want two measures out of this sample table:

 

 

Orders  Date         TargetRevenueMaxWorkDaysRevenueMonth
12344 29.03.2021 150001903.2021
12345 30.03.2021 150001903.2021
12346 31.03.2021 200002004.2021
12347 01.04.2021 200002004.2021
12348 02.04.2021 200002004.2021
12349 03.04.2021 200002004.2021
12350 04.04.2021 200002004.2021

From a calculation and revenue-wise perspective the last workday of a month belongs to the next month. Thats the reason you see that 31.03.2021 has April as monthdate  "04.2021" in its RevenueMonth column. Because of that I cannot use Date for filtering Ihink instead I use RevenueMonth which is formatted as Date column. Also in the table is a column showing the workdays and Targetrevenue for that repspective revenuemonth. 

1.I nead a measure for a KPI -Card which always display the max Workdays of current month. 

 

2.I need a measure for a KPI-Card which always showing me the TargetRevenue of current month. It is different each month.

 

Thank you very much in advance. 

Best. 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Applicable88 ,

 

Please try the following formula:

Max Workdays of current month =
VAR _month =
    CALCULATE (
        MAX ( 'Table'[RevenueMonth] ),
        FILTER (
            ALL ( 'Table' ),
            YEAR ( [Date] ) = YEAR ( TODAY () )
                && MONTH ( [Date] ) = MONTH ( TODAY () )
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[MaxWorkDays] ),
        FILTER ( 'Table', [RevenueMonth] = _month )
    )

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-eqin-msft
Community Support
Community Support

Hi @Applicable88 ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it.😀

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @Applicable88 ,

 

Please try the following formula:

Max Workdays of current month =
VAR _month =
    CALCULATE (
        MAX ( 'Table'[RevenueMonth] ),
        FILTER (
            ALL ( 'Table' ),
            YEAR ( [Date] ) = YEAR ( TODAY () )
                && MONTH ( [Date] ) = MONTH ( TODAY () )
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[MaxWorkDays] ),
        FILTER ( 'Table', [RevenueMonth] = _month )
    )

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

How can I make this As card.  

Like this 
12:00pm Has the highest value
inside the card "Actual Value"

amitchandak
Super User
Super User

@Applicable88 , Create a measure like

 

measure =
var _max = maxx(allselected(Table), Table[RevenueMonth])
var _maxdt = maxx(filter(Table, Table[RevenueMonth] =_max),[Date])
return
calculate(sum(Table[TargetRevenue]), filter(Table, Table[Date] =_maxdt))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak,

thanks so far, but I already have target revenues for the whole year. That means the table is not ending in this month and I cannot get the value with MAX() function. Otherwise it give values for next year. I need a function where it really giving me the revenuetarget of current month. 

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.