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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
RamiGamal
Frequent Visitor

Can't change the sorting of a Column

Hello Experts,

 

I have data set consists of Unqiue date column (365 different values) ,Output1 , Output2 and Output3.

I have added a visual to display the last value in Output1 with the measure 

MEASURE = LASTNONBLANK(Table1[Output1],Table1[Output1])

This measure always returns with the highest value so I figured out that the column is sorted based on itself but when I tried to change the sorting of the "Output1" column by "Date" Column, it gives me the error:

RamiGamal_0-1668604168915.png

 

Any help is much appreciated.

1 ACCEPTED SOLUTION

Hi @RamiGamal ,

 

If you want to get the last value instead of the highest value, please try following measure:

Measure = LASTNONBLANK('Table1'[Value],CALCULATE(MAX('Table1'[Date]),'Table1'[Date] = MAX('Table1'[Date])))

 

I think this is the result you want:

vyadongfmsft_0-1669197185846.png

Best regards,

Yadong Fang

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

4 REPLIES 4
v-yadongf-msft
Community Support
Community Support

Hi @RamiGamal 

 

As the error said, there can't be more than one value in 'Date' for the same value in 'RIR',

 

so the reason why you can't sort "Output1" column by "Date" Column is most probably that "Output1" column has duplicate values.

 

For example, I have a test table 1 which has unique values, [Value] column can sort by [Date] column:

vyadongfmsft_0-1668672430030.png

 

The test table 2 which has duplicate values, [Value] column can not sort by [Date] column:

vyadongfmsft_2-1668673012729.png

 

 

Best regards,

Yadong Fang

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

Thanks for your reply, this is well understood, but what is the best solution for this , cause also in your example If I try to get the last value it will give me the highest

Hi @RamiGamal ,

 

If you want to get the last value instead of the highest value, please try following measure:

Measure = LASTNONBLANK('Table1'[Value],CALCULATE(MAX('Table1'[Date]),'Table1'[Date] = MAX('Table1'[Date])))

 

I think this is the result you want:

vyadongfmsft_0-1669197185846.png

Best regards,

Yadong Fang

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

amitchandak
Super User
Super User

@RamiGamal , Both Date and RIR show have the same granularity

 

How to Create Sort Columns and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.