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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Michael85
Regular Visitor

Issue with incorrect results of a DAX for sharepoint list multi choice field.

Good day,

 

I have a bit of an issue with a DAX that is supposed to count the amount of times a choice appears in a multi choice column of a sharepoint List. 

 

Basically,

I created a table with the choices of the multi choice column using the following:

 

FlightDispatchCategories = DATATABLE(
    "Category", STRING,
    {
        {"Baggage"},{"Loading/unloading"},{"Cleaning"},{"Fueling"},
        {"Flight Plan"},{"ATC"},{"Customs"},{"Parking Congestion"},
        {"Missing Authorisation/Permit"},{"Weather"},{"Diversion"},{"Other"}
    }
)

Then I use the following DAX to calcuate each time one appears:

Flight CAT = 
SUMX(
    'Duty Manager Event Log',
    IF(
        CONTAINSSTRING('Duty Manager Event Log'[PurpleType], SELECTEDVALUE('FlightDispatchCategories'[Category])), 
        1, 
        0
    )
)

 

This somehow returns incorrect values.  Some with too much and some are missing. See below:

 

 

Michael85_0-1739034524872.png

 

In the above chart, there should be additionnal categories and the one displayed as 14 should actually be "10". 

 

The weird thing is that I did the exact same thing for another field in the same project and it worked fine. 

 

I would appreciate any insights as I have been struggling with this issue for a week now. 

 

Thank you

1 ACCEPTED SOLUTION
Michael85
Regular Visitor

@v-xinruzhu-msft  and @parry2k 

 

Thank you for your responses.

Unfortunately none seem to work. 

 

However I was able to find another method using reference Queries and grouping the data.

 

For now it seems to work. 

 

Thank you again for your help. 

Edit:   To solve the issue, I went into "transform data". 

Right clicked on my data table, used the reference option.  Using the now created reference query I was able to "expand to new rows" in the Multi choice column. 

 

Finally, I used the "group by" option in the transform menu.  This created a count of every choice which I was able to use in visuals. 

 

View solution in original post

4 REPLIES 4
Michael85
Regular Visitor

@v-xinruzhu-msft  and @parry2k 

 

Thank you for your responses.

Unfortunately none seem to work. 

 

However I was able to find another method using reference Queries and grouping the data.

 

For now it seems to work. 

 

Thank you again for your help. 

Edit:   To solve the issue, I went into "transform data". 

Right clicked on my data table, used the reference option.  Using the now created reference query I was able to "expand to new rows" in the Multi choice column. 

 

Finally, I used the "group by" option in the transform menu.  This created a count of every choice which I was able to use in visuals. 

 

Hi @Michael85 

It is glad that you solved your problem, you can accept you own answer as a solution so that more user can refer to, and if it is convenient for you, you can share your ways here so that it will help more user to solve the similar problem.

 

Best Regards!

Yolo Zhu

v-xinruzhu-msft
Community Support
Community Support

Hi,

Thanks for the solution parry2k  offered, and i want to offer some more information for user to refer to.

hello @Michael85 , you can change the measure to the following.

MEASURE =
COUNTROWS (
    FILTER (
        'Duty Manager Event Log',
        CONTAINSSTRING (
            [PurpleType],
            SELECTEDVALUE ( 'FlightDispatchCategories'[Category] )
        )
    )
)

 

Best Regards!

Yolo Zhu

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

 

parry2k
Super User
Super User

@Michael85 change SELECTEDVALUE  with MAX and see if it works.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors