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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Sdelpino
Regular Visitor

Dinamic mesure as category

Hi Comunity, hope you can help me with this challenge,

Given the data set in the "Dataset" below, I need a measure that can calculate the number of members who attended more than one event as the user chooses the events, and that measure can be used as a category to count the number of members who attended. For example, if the user select the events CALL CONV MITING PARTY events, I need to make a pie chart in the image.

 

MembersEvent
APARTY
AMITING
BMITING
DMITING
FMITING
ACONV
BCONV
CCONV
ACALL
DCALL
CCALL
FCALL
FPARTY
CPARTY

 

Example.jpg

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

One of ways is to create a supporting table like below.

 

Jihwan_Kim_1-1665458287002.png

Jihwan_Kim_2-1665458303216.png

 

 

Jihwan_Kim_0-1665458262070.png

 

Expected result measure: =
VAR _attendcount =
    MAX ( Attended[Attended] )
VAR _eventscountbymembers =
    ADDCOLUMNS (
        DISTINCT ( Data[Members] ),
        "@eventscount", CALCULATE ( COUNTROWS ( DISTINCT ( Data[Event] ) ) )
    )
VAR _filtertable =
    FILTER ( _eventscountbymembers, [@eventscount] = _attendcount )
VAR _allmembers =
    COUNTROWS ( DISTINCT ( Data[Members] ) )
RETURN
    DIVIDE ( COUNTROWS ( _filtertable ), _allmembers )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Sdelpino
Regular Visitor

This works perfect!!! 

Thanks!!

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

One of ways is to create a supporting table like below.

 

Jihwan_Kim_1-1665458287002.png

Jihwan_Kim_2-1665458303216.png

 

 

Jihwan_Kim_0-1665458262070.png

 

Expected result measure: =
VAR _attendcount =
    MAX ( Attended[Attended] )
VAR _eventscountbymembers =
    ADDCOLUMNS (
        DISTINCT ( Data[Members] ),
        "@eventscount", CALCULATE ( COUNTROWS ( DISTINCT ( Data[Event] ) ) )
    )
VAR _filtertable =
    FILTER ( _eventscountbymembers, [@eventscount] = _attendcount )
VAR _allmembers =
    COUNTROWS ( DISTINCT ( Data[Members] ) )
RETURN
    DIVIDE ( COUNTROWS ( _filtertable ), _allmembers )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.