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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
Sashavg14
Helper I
Helper I

DAX Formula

CurrentMonthAverageYield =
VAR CurrentDate = MAX('calender yield'[Date])
RETURN
CALCULATE(
    AVERAGE('Production orders'[Qty in kg]),
    FILTER(
        'calender yield',
        'calender yield'[Date] >= STARTOFMONTH(TODAY()) &&
        'calender yield'[Date] <= ENDOFMONTH(TODAY())
    )
)
When I try to create this formula to show the current month average yield I get red lines under "TODAY" and an error message: "Parameter is not the correct type".
1 ACCEPTED SOLUTION
Dangar332
Super User
Super User

Hi, @Sashavg14 

You can't Pass scalar value to STARTOFMONTH function you need to provide column name
Try below measure

CurrentMonthAverageYield =
VAR CurrentDate = MAX('calender yield'[Date])
var Monthstart = eomonth(today(),-1)+1
var MonthEnd = eomonth(today(),0)
RETURN
CALCULATE(
    AVERAGE('Production orders'[Qty in kg]),
    FILTER(
        'calender yield',
        'calender yield'[Date] >= Monthstart  &&
        'calender yield'[Date] <= MonthEnd 
    )
)

 

View solution in original post

2 REPLIES 2
Dangar332
Super User
Super User

Hi, @Sashavg14 

You can't Pass scalar value to STARTOFMONTH function you need to provide column name
Try below measure

CurrentMonthAverageYield =
VAR CurrentDate = MAX('calender yield'[Date])
var Monthstart = eomonth(today(),-1)+1
var MonthEnd = eomonth(today(),0)
RETURN
CALCULATE(
    AVERAGE('Production orders'[Qty in kg]),
    FILTER(
        'calender yield',
        'calender yield'[Date] >= Monthstart  &&
        'calender yield'[Date] <= MonthEnd 
    )
)

 

Thank you so much!!!

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Kudoed Authors