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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
MinnieMouse
New Member

Help with dax formula

Hello! I need to add a "distinctcount" for the session_id in this formula, but I have no luck with it. Is it even possible? Or would I better create a measure instead of a table?


Basically I need to find out how many distinct sessions have 2 or more rows (views) from the "Table_views". 

the formula I've used for the table is: 


2nd screen view=

       Var_Table=
         SUMMARIZE(

                 'Table_views'

                 'Table_views'[session_id],
                  "_Count",COUNTROWS('Table_views')

                  )

        RETURN

      COUNTROWS(FILTER(_Table,[_Count] >=2)) 

3 REPLIES 3
Samarth_18
Community Champion
Community Champion

Hi @MinnieMouse ,

 

You could try below code:-

Var_Table =
FILTER (
    SUMMARIZE (
        'Table_views',
        'Table_views'[session_id],
        "_Count",
            COUNTROWS (
                FILTER (
                    'Table_views',
                    'Table_views'[session_id] = EARLIER ( 'Table_views'[session_id] )
                )
            )
    ),
    [_Count] >= 2
)

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Thank you for your time! That generates exactly the same output as the formula i've used. I suppose these are distinct session_id as nothing happens when I filter it in the visual! Thanks again! 

@MinnieMouse , It would be very helpful to answer if you could share the sample data(not in a screenshot) with expected output.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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