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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Sorting data for multi row card visual

Hello everyone. I'm having some trouble displaying data on a multi row card.

My dataset is an SharePoint document that contains 5 columns, one of which is a calculated by dax.

Calheiro_0-1641556849616.png

Disclaimer: Scheduled column is in "dd/mm/yyy" format, and On Hold column is = Datediff(Today(),[Scheduled],Day)

My goal is to create a multi row visual that displays the next activity to begin of a certain Model.

I've created the visual using the fields below:

Calheiro_1-1641557348859.png

With Next Activity being the measure = Calculate(Min([Activity]),[Days On Hold]=Min([Days On Hold])) 

The thing is the multi row card is displaying the Activity in Alphabetical Order, which is incorrect. The rule is if more than one activity is scheduled for the same day we must sort the dataset by the Order column to know which activity is the next one. Below is an example of the incorrect visual (using the dataset sample I made at the start of this post):

Calheiro_3-1641558012967.png

And this is how it is supposed to be (still using the dataset sample I made at the start of this post):

Calheiro_4-1641558216463.png

And as you can see, even if the activities are scheduled to the same day, the card still manages to display the real first Activity sorted by the Order column. Edit: I've already tried "Sort By Column". Can someone help me achieve this configuration? Thanks in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

I think you can try If function and add some filter in your code to achieve your goal.

My Sample:

1.png

We can see in my sample 1s with same "Days On Hold" should return "Refresh Data" for the smallest Order .

2s should return "Refresh Data" for the smallest "Days On Hold".

Measure:

Next Activity =
VAR _COUNT_SCHEDULE_AFTER_TODAY =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Scheduled] ),
        FILTER ( 'Table', 'Table'[Scheduled] > TODAY () )
    )
VAR _ACTIVITY_MAX_ORDER =
    CALCULATE (
        MAX ( 'Table'[Activity] ),
        'Table'[Days On Hold] > 0
            && 'Table'[Order] = MIN ( 'Table'[Order] )
    )
VAR _NEXT_ACTIVITY =
    CALCULATE (
        MIN ( [Activity] ),
        'Table'[Days On Hold] > 0
            && 'Table'[Days On Hold] = MIN ( 'Table'[Days On Hold] )
    )
RETURN
    IF ( _COUNT_SCHEDULE_AFTER_TODAY = 1, _ACTIVITY_MAX_ORDER, _NEXT_ACTIVITY )

Result 

 1.png

Best Regards,
Rico Zhou

 

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

5 REPLIES 5
mh2587
Super User
Super User

Select the Activity Column in Data Tab and then sort by the order column 

Sorting.PNG


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Anonymous
Not applicable

Sorry, I didn't mention on the Post.

But I've already sorted Activity Column by Order Column as you suggested.

Then try visual option to sort by order column


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Anonymous
Not applicable

I'm not using Order Column at the visual and I can't seem to find a way that let me Sort the  activities without applying Order to the visual. Besides, anytime I try to add said column to the visual it shows all of the Activities instead of only the next one.

Anonymous
Not applicable

Hi @Anonymous ,

 

I think you can try If function and add some filter in your code to achieve your goal.

My Sample:

1.png

We can see in my sample 1s with same "Days On Hold" should return "Refresh Data" for the smallest Order .

2s should return "Refresh Data" for the smallest "Days On Hold".

Measure:

Next Activity =
VAR _COUNT_SCHEDULE_AFTER_TODAY =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Scheduled] ),
        FILTER ( 'Table', 'Table'[Scheduled] > TODAY () )
    )
VAR _ACTIVITY_MAX_ORDER =
    CALCULATE (
        MAX ( 'Table'[Activity] ),
        'Table'[Days On Hold] > 0
            && 'Table'[Order] = MIN ( 'Table'[Order] )
    )
VAR _NEXT_ACTIVITY =
    CALCULATE (
        MIN ( [Activity] ),
        'Table'[Days On Hold] > 0
            && 'Table'[Days On Hold] = MIN ( 'Table'[Days On Hold] )
    )
RETURN
    IF ( _COUNT_SCHEDULE_AFTER_TODAY = 1, _ACTIVITY_MAX_ORDER, _NEXT_ACTIVITY )

Result 

 1.png

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.