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
randomUser21
Helper II
Helper II

how do I sort and synchronize a segment

Hello everybody,

 

I downloaded a template from the internet, but I can't reproduce two things.
1-How did he sort the “type” segment?
In my case on my model the segment is sorted in alphabetical order I cannot pull on the "sort" column.

2-how does he modify the period in the segment when he selects a type, in my model it does not work, and in the second tab also

Here is my Power Bi file:

https://www.dropbox.com/scl/fi/86y38xuqncnlrnwa3lxx1/test.pbix?rlkey=k5p0zf6ix2tvv4wlgk618m0aq&st=gd...

 

anyone can help me ?

6 REPLIES 6
v-huijiey-msft
Community Support
Community Support

Hi @randomUser21 ,

 

Thank you @parry2k for answering your first question, now I will answer your second question.

 

What you have placed in your Slicer is the Type field of the Date Periods table, which is a calculated table.

 

The calculation table syntax is as follows:

vhuijieymsft_0-1715152502354.png

 

The syntax for this is to create a table that combines different time periods (MTD, QTD, YTD, Last Month, Last Quarter, Last Year, All Time, and Custom). For each time period, add two new columns: “Type” and “Sort”.

 

The Union function is used to merge rows from two or more tables into one. Similar to Append in Power Query, you can visualize what this function does in the following figure:

vhuijieymsft_1-1715152502355.png

 

The ADDCOLUMNS function serves to extend the table by adding new columns.

 

What the DATESMTD function does is return a table that contains a column of dates for the month to date in the current context.

 

DATESQTD function's role is to return a table, this table contains the current context of the quarter to date a column of dates.

 

DATESYTD function is to return a table containing the current context of the year to date a column of dates.

 

The role of the PREVIOUSMONTH function is to return a table containing a column of all dates from the previous month.

 

The role of the PREVIOUSQUARTER function is to return a table that contains a column of all dates from the previous quarter.

 

PREVIOUSYEAR function serves to return a table, this table contains all the dates of the previous year's columns.

 

For more information about these functions see:

UNION function (DAX) - DAX | Microsoft Learn

ADDCOLUMNS function (DAX) - DAX | Microsoft Learn

DATESMTD function (DAX) - DAX | Microsoft Learn

DATESQTD function (DAX) - DAX | Microsoft Learn

DATESYTD function (DAX) - DAX | Microsoft Learn

PREVIOUSMONTH function (DAX) - DAX | Microsoft Learn

PREVIOUSQUARTER function (DAX) - DAX | Microsoft Learn

PREVIOUSYEAR function (DAX) - DAX | Microsoft Learn

 

In short, through the Addcolumn function to add a different time period of the column to filter time, through the Date Periods table, Date table, the relationship between the SellIn table will be filtered out of the time range from the Date Periods table passed to the Date table and finally passed to the SellIn table, and then the SellIn table and then based on this filtered out of the time range to calculate _Qty and _Qty PY.

vhuijieymsft_2-1715152513077.png

 

If you have any further questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

@v-huijiey-msft @parry2k  thank you for your response, I do not understand in the demo dates tab if I select a value of "date period" segment, the date range in segment date is updated, however when I do exactly the same thing in the tab test date range in date segment does not change

parry2k
Super User
Super User

@randomUser21 sorry not sure I understood your question. Please clarify.



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.

parry2k
Super User
Super User

@randomUser21 it is a pretty straightforward, type is sorted by sort column, read more about sort column here https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column.

 

If you select the type column, on column tools, under sort by column you will sort column is selected/

 

parry2k_0-1715097163568.png

 



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.

@parry2kthank's and how can i update segment date on select other segment "type"

@v-huijiey-msft  thank's for your answer
in the first tab it's work like this, on check date period the dates range segment date is updated :

tab1_update.png

 

in the second tab if i do the same it's not work :

tab2.png

 

 

 it's the same table and the same field

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.