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
Syndicate_Admin
Administrator
Administrator

Summarize a column from another table while using a slicer

Hello! I have two tables with the following, in a one-to-many relationship:

Data

IdValue
Off$1
Xy$2
Cz$3

Activities

IdNumberState
OffBobbyOngoing
XyBillyFull
OffBobbyFull
XyBennyOngoing
OffBillyWaiting
CzBennyFull

In the report I have a slicer to select a name and a data table, where I want to show the progress of the activities for the selected name. This should be summarized, so show In progress if something is in progress, if not show Not Started if there are any, if not showing waiting if there are any, if not showing full if any, otherwise leave it blank. Ideally, this will be the result:

[Billy selected in Name slicer]
Data

IdValueState
Off$1Waiting
Xy$2Full

[Bobby selected in Name slicer]
Data

IdValueState
Off$1Ongoing

[Benny selected in Name slicer]
Data

IdValueState
Xy$2Ongoing
Cz$3Full

There are many more names and IDs, but only a few states. How do I configure this?

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Syndicate_Admin 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Activities:

d1.png

 

Data:

d2.png

 

You may create two measures  as below.

Result Value = 
SUMX(
    ADDCOLUMNS(
        Activities,
        "Result",
        LOOKUPVALUE(Data[Value],Data[Id],[Id])
    ),
    [Result]
)
Result State = 
CONCATENATEX(
    SUMMARIZE(
        Activities,
        Activities[Id],
        "Result",
        CONCATENATEX(
            Activities,
            [State],
            ","
        )
    ),
    [Result],
    ","
)

 

Result:

d3.pngd4.pngd5.png

 

Best Regards

Allan

 

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-alq-msft
Community Support
Community Support

Hi, @Syndicate_Admin 

 

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Activities:

d1.png

 

Data:

d2.png

 

You may create two measures  as below.

Result Value = 
SUMX(
    ADDCOLUMNS(
        Activities,
        "Result",
        LOOKUPVALUE(Data[Value],Data[Id],[Id])
    ),
    [Result]
)
Result State = 
CONCATENATEX(
    SUMMARIZE(
        Activities,
        Activities[Id],
        "Result",
        CONCATENATEX(
            Activities,
            [State],
            ","
        )
    ),
    [Result],
    ","
)

 

Result:

d3.pngd4.pngd5.png

 

Best Regards

Allan

 

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

Anonymous
Not applicable

Assume you have the following tables...

 

Table Name : Data

sreenathv_0-1614936012444.png

Table Name: Activities

sreenathv_1-1614936042096.png

Create two measures...

Value Measure = 
VAR CurrentID = SELECTEDVALUE(Activities[Id])
VAR Result = LOOKUPVALUE(Data[Value],Data[Id],CurrentID)
RETURN Result
State Measure = 
VAR States = VALUES(Activities[State])
VAR Result =
    SWITCH(
        TRUE(),
        "Ongoing" IN States,"On Going",
        "Not Started" in States, "Not Started",
        "Waiting" in States, "Waiting",
        "Full" in States, "Full",
        BLANK()
    )
RETURN Result

Add a matrix visual to your report and add the field Activites[Id] to the Rows and add the two measures created above to the values section.

 

Also, add a slicer with the Activities[Number] field. 

This will give the following output...

 

sreenathv_2-1614936188319.png

sreenathv_3-1614936212558.png

sreenathv_4-1614936222408.png

sreenathv_5-1614936237690.png

 

 

 

 

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.