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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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))

)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 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.

October NL Carousel

Fabric Community Update - October 2024

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