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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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

)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors