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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
AlvRomero
Regular Visitor

How to iterate a table filtering by multiple columns of the same table

Hi everyone, I hope you are having a nice day

I was working on my report when I encountered the following problem. I have a table like the following:

 

PersonIdCategory             Date                                Value
15

2023-12-01

10
16

2023-12-01

8
15

2023-12-02

6
35

2023-12-01

5
44

2023-12-01

1


What I need is to get, in a measure if possible, the value for each DATE in category 5. That is, I would like the final result to be as follows:

PersonIdDate                          New Measure
12023-12-0110
12023-12-026
32023-12-015

 

Thank you very much in advance for your help,

 

Best regards

3 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi, @AlvRomero 

 

Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.

 

vyaningymsft_0-1708567619363.png

 

 

Measure:

 

MEASURE =

VAR _5 =

    SELECTEDVALUE ( 'Table'[Category] )

VAR _value =

    CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Category] = _5 ) )

RETURN

    IF ( _5 = 5, _value )

 


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 

 

View solution in original post

AlvRomero
Regular Visitor

Hi, thank you for your response.

When I apply the solution that you have provided me what happens is that it adds the sum of all the category to all the people, that is to say, the result that we obtain is the following one:

(I will put the result of the measure that you have provided me and the one we are looking for)

AlvRomero_0-1708588581280.png


Thanks for your input, I hope we can find a solution to the problem,

Best Regards




View solution in original post

Anonymous
Not applicable

Hi, @AlvRomero 

You can change the SUM to Max, everything works fine on my side of the implementation, do you have any other filters on your data in Power BI Desktop that affect the implementation results?

 

vyaningymsft_0-1708594072467.png

Measure:

 

MEASURE1 = 
VAR _5 =
    SELECTEDVALUE ( 'Table'[Category] )
VAR _value =
    CALCULATE ( MAX ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Category] = _5 ) ,ALL('Table'))
RETURN
    IF ( _5 = 5, _value )

 

 

 

Best Regards,
Yang
Community Support Team

View solution in original post

3 REPLIES 3
AlvRomero
Regular Visitor

Hi, thank you for your response.

When I apply the solution that you have provided me what happens is that it adds the sum of all the category to all the people, that is to say, the result that we obtain is the following one:

(I will put the result of the measure that you have provided me and the one we are looking for)

AlvRomero_0-1708588581280.png


Thanks for your input, I hope we can find a solution to the problem,

Best Regards




Anonymous
Not applicable

Hi, @AlvRomero 

You can change the SUM to Max, everything works fine on my side of the implementation, do you have any other filters on your data in Power BI Desktop that affect the implementation results?

 

vyaningymsft_0-1708594072467.png

Measure:

 

MEASURE1 = 
VAR _5 =
    SELECTEDVALUE ( 'Table'[Category] )
VAR _value =
    CALCULATE ( MAX ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Category] = _5 ) ,ALL('Table'))
RETURN
    IF ( _5 = 5, _value )

 

 

 

Best Regards,
Yang
Community Support Team

Anonymous
Not applicable

Hi, @AlvRomero 

 

Based on your description, I have created many measures to achieve the effect you are looking for. Following picture shows the effect of the display.

 

vyaningymsft_0-1708567619363.png

 

 

Measure:

 

MEASURE =

VAR _5 =

    SELECTEDVALUE ( 'Table'[Category] )

VAR _value =

    CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Category] = _5 ) )

RETURN

    IF ( _5 = 5, _value )

 


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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