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
RichOB
Helper II
Helper II

Measure to obtain values in a column

Hi, what measure would show in a card that there have been 7 instances where the fire service was called in the last 3 months, please?

 

MonthFire Service Called 
AprilYes
AprilNo
April Yes
AprilNo
MayNo
MayYes
MayYes
MayNo
JuneNo
JuneYes
JuneYes
June Yes
1 ACCEPTED SOLUTION
v-zhengdxu-msft
Community Support
Community Support

Hi @RichOB 

 

Please try this:
Here I create a measure:

MEASURE =
VAR _currentMonth =
    MONTH ( TODAY () )
RETURN
    COUNTROWS (
        FILTER (
            ALLSELECTED ( 'Table' ),
            MONTH ( 'Table'[Month] ) >= _currentMonth - 2
                && [Fire Service Called ] = "Yes"
        )
    )

The result is as follow:

vzhengdxumsft_0-1719198413087.png

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-zhengdxu-msft
Community Support
Community Support

Hi @RichOB 

 

Please try this:
Here I create a measure:

MEASURE =
VAR _currentMonth =
    MONTH ( TODAY () )
RETURN
    COUNTROWS (
        FILTER (
            ALLSELECTED ( 'Table' ),
            MONTH ( 'Table'[Month] ) >= _currentMonth - 2
                && [Fire Service Called ] = "Yes"
        )
    )

The result is as follow:

vzhengdxumsft_0-1719198413087.png

 

 

Best Regards

Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3CloudThomas
Super User
Super User

Edit the query in Power Query (Transform Data). Add a column to query that converts the Yes to 1 and No to 0. Save query and return to Power BI Desktop.

Add a measure that sums the new column - Service Called Count = SUM(<new column>)

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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