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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Aydan_Abdul
New Member

DAX

Hi,everyone! I have DAX problem.

I have frequecy table.
My input table is this.
id                freq_min    freq_max
136
1610
11018
11820
12123
235
2510
21113

I want this:
 id            freq_min      freq_max
1320
12123
2310
21113
3-6 ; 6-10; 10-18; 18-20 ---》2-20
They are ranges and I combine ranges.

With loves

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @Aydan_Abdul,

 

Can you please try this:

CombinedRanges = 
VAR SortedTable = SUMMARIZE(FrequencyTable, FrequencyTable[id], FrequencyTable[freq_min], FrequencyTable[freq_max])
RETURN
GENERATE(
   DISTINCT(SortedTable[id]),
   ADDCOLUMNS(
      FILTER(SortedTable, [id] = EARLIER([id])),
      "CombinedFreqRange",
      IF(
         EARLIER(SortedTable[freq_max]) >= SortedTable[freq_min],
         MAXX(FILTER(SortedTable, [id] = EARLIER([id]) && EARLIER(SortedTable)[freq_max] >= SortedTable[freq_min]), SortedTable[freq_max]),
         SortedTable[freq_max]
      )
   )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution?
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Syntax is wrong. Thanks a lot!

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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