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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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