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
tod
Frequent Visitor

Help with creating custom dax columns

I have a dataset with various numerical value as text. I like to create two custom Dax columns that (1) identifies the top 3 values, but is dependent on the text values in a second column, and (2) create another dax column to describe the results. The example below shows the desired result of the 2 custom dax columns. Here the data is filtered for category A (in Column 2). 

 

Column 1       Column 2           Custom Dax Column 1          Customer Dax Column 2

10                   A                        10                                          First Top Value

9                     B                         null                                       Remaining Value

3                     A                         3                                           Third Top Value

6                     A                         6                                           Second Top Value

8                     C                         null                                       Remaining Value

 

Any and all help appreciated. Thanks

1 ACCEPTED SOLUTION

@tod -

Did you try:

ChrisMendoza_0-1620398860610.png

 






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

4 REPLIES 4
tod
Frequent Visitor

Thanks very much for taking the time to respond and providing the solution!!

 

I used it in my Power BI desktop report and for some reason, I'm not getting the same outcome. The data is filtered only on A. Therefore, remaining values are not showing. Not sure what I'm doing wrong in Power BI desktop. 

 

Capture.PNG

 

 

@tod -

Did you try:

ChrisMendoza_0-1620398860610.png

 






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



Thanks! in my Dax Column 1, the data was summarized. Selecting "Don't Summarize" displayed the other categories. 

ChrisMendoza
Resident Rockstar
Resident Rockstar

@tod  -

You can do as:

Custom DAX Column 1 = 
IF(
    TableName[Column2] = "A",
    VALUE(TableName[Column1]), BLANK()
)
Custom DAX Column 2 = 
VAR calc =
    IF (
        ISNUMBER ( TableName[Custom DAX Column 1] ),
        RANKX (
            TableName,
            TableName[Custom DAX Column 1],
            TableName[Custom DAX Column 1]
        ),
        BLANK ()
    )
RETURN
    SWITCH (
        TRUE (),
        calc = 1, "First Top Value",
        calc = 2, "Second Top Value",
        calc = 3, "Third Top Value",
        "Remaining Value"
    )

image.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.