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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Arete
Helper I
Helper I

Having issue with counting results of a measure

Hi! I'd like to count the number of months over a target margin but the measure I wrote is giving me an error:

 

Months over Target Margin = 
VAR Target = 
DIVIDE(
    [2022 Total Amount Converted] - [2022 Total Costs], [2022 Total Amount Converted]
)
return
    CALCULATE(
        COUNTA('Calendar'[Month]),
        Target >= .5
    )

 

Arete_0-1669961873509.png

 

I'm pretty new to DAX so any help is appreciated!

 

 

 

3 REPLIES 3
amitchandak
Super User
Super User

@Arete , Try like

 

Months over Target Margin =
VAR Target =
DIVIDE(
[2022 Total Amount Converted] - [2022 Total Costs], [2022 Total Amount Converted]
)
return
CALCULATE(
COUNTROWS(Filter(Values('Calendar'[Month]),Target >= .5))

)

Thanks for the reply! It looks like it's working but I need the discount count of months:

 

Arete_0-1670034863600.png

It should be 7 but instead, it says 13. Any suggestions?

@amitchandak any suggestions?

 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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