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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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