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
Anonymous
Not applicable

Filter countx of a measure

I used the following measure 

MEASURE Capacity_Share = CALCULATE(100 * DIVIDE(SUM('19981201 Victoria'[Wind -  GWh]),'19981201 Victoria'[MEASURE_PowerBiComm]))

to plot the following bar chart.

 

bar chartbar chart

 

Next to the bar chart I am trying to show a table with the months that are < 60.

With the following measure

MEASURE Quiet_Months = COUNTX(VALUES('19981201 Victoria'[date]),[MEASURE Capacity_Share])

I get

 

TableTable 

 

But how do I filter count for measure < 60?

1 ACCEPTED SOLUTION

@Anonymous 
Sorry that was a typo mistake

MEASUR Quiet_Months =
COUNTROWS (
    FILTER (
        ADDCOLUMNS (
            VALUES ( '19981201 Victoria'[date] ),
            "@Capacity", [MEASURE Capacity_Share]
        ),
        [@Capacity] < 60
    )
)

View solution in original post

8 REPLIES 8
tamerj1
Super User
Super User

Hi @Anonymous 

please use 

MEASUR Quiet_Months =
COUNTROWS (
    FILTER (
        ADDCOLUMNS (
            VALUES ( '19981201 Victoria'[date] ),
            "@Capacity", [MEASURE Capacity_Share]
        ),
        [&Capacity] < 60
    )
)
Anonymous
Not applicable

Hello, @tamerj1 

Your solution has not worked.

 

DAX does not acknowledge [&Capacity]

 

[&Capacity] not acknowledged[&Capacity] not acknowledged

 

If I replace it with [MEASURE Capacity_Share], the result is 

 

wrong resultswrong results

 

when it should be

 

Correct resultCorrect result

Cheers

@Anonymous 
Sorry that was a typo mistake

MEASUR Quiet_Months =
COUNTROWS (
    FILTER (
        ADDCOLUMNS (
            VALUES ( '19981201 Victoria'[date] ),
            "@Capacity", [MEASURE Capacity_Share]
        ),
        [@Capacity] < 60
    )
)
Anonymous
Not applicable

Hello, @tamerj1 

I have fixed it

 

fixed codefixed code

 

but it's still not working

 

Wrong resultsWrong results

@Anonymous 

Would you please share the code of [MEASURE Capacity_Share]?

Anonymous
Not applicable

MEASURE Capacity_Share = CALCULATE(100 * DIVIDE(SUM('19981201 Victoria'[Wind -  GWh]),'19981201 Victoria'[MEASURE_PowerBiComm]))


MEASURE_PowerBiComm = CALCULATE(MAX('19981201 Victoria'[Wind -  GWh]),'19981201 Victoria'[date] <= MAX('19981201 Victoria'[date]))

Thank you @Anonymous 

Would you please add the date to the matrix row heirarchy and see what results you get for [MEASURE Capacity_Share] Measure? Otherwise can we zoom connect for beeter assessment?

Anonymous
Not applicable

Hello, @tamerj1 

I started the chart from scratch using different data and, lo and behold, your formula worked fine. Cheers

 

countrows of a measurecountrows of a measure

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.

Top Solution Authors
Top Kudoed Authors