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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Count column per category on basis of values from measure

Hello, 

I have a dummy table as below:01Abhi_0-1678355957458.png

Diff value is not a column but a calculated measure.

What I need is a table as below:

01Abhi_1-1678356077374.png

So on basis of measure  "Diff value", I want to calculate count of elements that have value >5.

I am trying to work with below DAX:

Count = SUMMARIZE(table ,table[ElementName],"Count DiffValue>5",
'Measure'[Diff Value]).
The above code is not working and it gives error as below:
01Abhi_2-1678357426745.png

 

Is there another method to group by on basis of values from a measure?

 

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Try

Count Diff Value > 5 =
VAR SummaryTable =
    ADDCOLUMNS (
        SUMMARIZE ( 'Table', 'Table'[Element], 'Table'[Coordinates] ),
        "@diff value", [Diff value]
    )
VAR Result =
    COUNTROWS ( FILTER ( SummaryTable, [@diff value] > 5 ) )
RETURN
    Result

View solution in original post

2 REPLIES 2
Ahmedx
Super User
Super User

Screen Capture #463.pngScreen Capture #462.png

johnt75
Super User
Super User

Try

Count Diff Value > 5 =
VAR SummaryTable =
    ADDCOLUMNS (
        SUMMARIZE ( 'Table', 'Table'[Element], 'Table'[Coordinates] ),
        "@diff value", [Diff value]
    )
VAR Result =
    COUNTROWS ( FILTER ( SummaryTable, [@diff value] > 5 ) )
RETURN
    Result

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.