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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rob_vander
Helper I
Helper I

sum values less than number selected from slicer

Hi All,

 

I have two tables Data & Sequence Dim. Both tables are linked on Sequence. In reality it's many to one join, but it's basic sample so you can see one to one relation.

 

Data table:

rob_vander_2-1696632331347.png

 

Sequence Dim table:

rob_vander_3-1696632451770.png

 

Requirement:

When I select any number from Sequence field in Sequence Dim table, I need to check that Sequence field in Data table and pick all the number less than or equal to selected number for each Type and apply sum over that Value.

 

for eg. When I select number 5 from Seqence in Sequence Dim table, I need to show below output

 

TypeValuecheck <=5 Sequence in data table
a451+2+4
b953+4+5
c2152+3+4

 

When I select number 3 from Seqence in Sequence Dim table, I need to show below output

TypeValuecheck <=3 Sequence in data table
a201+2
b403
c1252+3

 

Similarly, user can select any number and dynamically report should reflect the values based on selection

 

Note:  I don't want to break or disconnect relationship between the table.

 

 

1 ACCEPTED SOLUTION
kushal_chawda
Frequent Visitor

@rob_vander  If I understood it correctly you can try below DAX

 

sum of value = 
 VAR selected_sequence = SELECTEDVALUE('Sequence Dim'[Sequence])
 VAR sum_value = CALCULATE(SUM(Data[Value]),
                              REMOVEFILTERS('Sequence Dim'),
                             KEEPFILTERS(Data[Sequence]<= selected_sequence))
RETURN sum_value

 

kushal_chawda_0-1696709833640.pngkushal_chawda_1-1696709870114.png

 

View solution in original post

3 REPLIES 3
kushal_chawda
Frequent Visitor

@rob_vander  If I understood it correctly you can try below DAX

 

sum of value = 
 VAR selected_sequence = SELECTEDVALUE('Sequence Dim'[Sequence])
 VAR sum_value = CALCULATE(SUM(Data[Value]),
                              REMOVEFILTERS('Sequence Dim'),
                             KEEPFILTERS(Data[Sequence]<= selected_sequence))
RETURN sum_value

 

kushal_chawda_0-1696709833640.pngkushal_chawda_1-1696709870114.png

 

Hi Kushal,

I have Fiscal Year and Fiscal Week column, and If I select any fiscal week from slicer then it give me sum from First fiscal week to selected week on slicer. So, your trick worked for me. But I also want to get same data for last year. Can you help me with that?

For example, In slicer we select Fiscal Year 2024 Week 5, then based on your DAX code I got the sum of sales for Fiscal week 1 to Fiscal week 5. And I want to compare this data with sum of sales of Fiscal year 2023 from Week 1 to 5.

@kushal_chawda that works

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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