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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Koy
Helper I
Helper I

Help with Sorting

Trying to sort a column Line Item by Line Item Sort as shown below.  Getting an error message and I just can't see why ...  I don't see any duplicates

Koy_0-1725038368476.png

 

Running a similar table and it works...

Koy_1-1725038465129.png

Appreciate any help!
Koy

1 ACCEPTED SOLUTION
Koy
Helper I
Helper I

I did a reboot, and now it works as expected.  Didn't change anything, so was glitchin the martrix for a bit I guess.

View solution in original post

10 REPLIES 10
Koy
Helper I
Helper I

I did a reboot, and now it works as expected.  Didn't change anything, so was glitchin the martrix for a bit I guess.

Anonymous
Not applicable

Thank you lbendlin 

Hi, @Koy 

Your current sort is working. You can share your DAX expression here and mark it as a solution. This way, so that others in the community can quickly find answers to similar problems, reducing the time they spend searching for answers.
Your sharing will work with us to promote the development of the community. Thank you again for your cooperation.

 

 

Best Regards

Jianpeng Li

lbendlin
Super User
Super User

Is that first Line Item a BLANK() or an empty string?

Sorry, misunderstood.  The first line item is just an empty cell.  

Try without it. I don't think you can sort by BLANK()

No, i mean in the reference/sort table, not in the fact table.

It does not.  Sorry I am new to all this, but here is what the output looks like.  My replies keep getting deleted as SPAM for some reason.

Koy_0-1725050541641.png

Based on this measure for the first column...

Koy_1-1725050571413.png

 

 

You seem to be mixing topics. Your original question was about the sorting issue?

Using it to make a table like the below using measures like this 

Gross to Net OL =
 VAR _disc = CALCULATE(SUMX('1_BPC','1_BPC'[FIN_DATA]),'5_AcctRef'[Account Number]="6541303") / [FX]
 
 RETURN
 switch(SELECTEDVALUE('Gross to Net'[Category]),
    "Gross Sales",
        if(HASONEVALUE('Gross to Net'[Line Item]),
            Switch(SELECTEDVALUE('Gross to Net'[Line Item]),
                "Discount",format(_disc / [Units] *1000,[format2]),
                "Buydown",format([BD]/[Units]*1000,[format2])
            ),format([GS] / [Units]*1000,[format2])
       ),
    "Price, net",
        if(HASONEVALUE('Gross to Net'[Line Item]),
            Switch(selectedvalue('Gross to Net'[Line Item]),
                "Key Acct",format([KA]/[Units]*1000,[format2]),
                "SMP",format([SMP]/[Units]*1000,[format2]),
                "Coupon",format([Coup]/[Units]*1000,[format2]),
                "WHS Terms",format(([To Customer] - _disc)/[Units]*1000,[format2]),
                "Retail Prgm",format([To Store]/[Units]*1000,[format2]),
                "FET",format([FET]/[Units]*1000,[format2])
            ),format(([GS]+[BD]+ _disc) / [Units] *1000,[format2])
        ),
    "Net Revenue",format([NR]/[Units]*1000,[format2])
)

Koy_0-1725050112626.png

 

I am using this table to help format this measure as a P&L view  similar to this which uses the second table I screenshotted that had no issues....

Gross to Net OL =
 VAR _disc = CALCULATE(SUMX('1_BPC','1_BPC'[FIN_DATA]),'5_AcctRef'[Account Number]="6541303") / [FX]
 
 RETURN
 switch(SELECTEDVALUE('Gross to Net'[Category]),
    "Gross Sales",
        if(HASONEVALUE('Gross to Net'[Line Item]),
            Switch(SELECTEDVALUE('Gross to Net'[Line Item]),
                "Discount",format(_disc / [Units] *1000,[format2]),
                "Buydown",format([BD]/[Units]*1000,[format2])
            ),format([GS] / [Units]*1000,[format2])
       ),
    "Price, net",
        if(HASONEVALUE('Gross to Net'[Line Item]),
            Switch(selectedvalue('Gross to Net'[Line Item]),
                "Key Acct",format([KA]/[Units]*1000,[format2]),
                "SMP",format([SMP]/[Units]*1000,[format2]),
                "Coupon",format([Coup]/[Units]*1000,[format2]),
                "WHS Terms",format(([To Customer] - _disc)/[Units]*1000,[format2]),
                "Retail Prgm",format([To Store]/[Units]*1000,[format2]),
                "FET",format([FET]/[Units]*1000,[format2])
            ),format(([GS]+[BD]+ _disc) / [Units] *1000,[format2])
        ),
    "Net Revenue",format([NR]/[Units]*1000,[format2])
)

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors
Top Kudoed Authors