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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Applicable88
Impactful Individual
Impactful Individual

RangOver Sum and color formatting

Hello,

 

i haven't found the equivalent function to qlik's rangesum(). With a typical substraction I cannot return my wanted value.

I have following table:

 

MaterialTotalOnStockReserveDateRangeSum
ZZZ120020001.07.20211000
ZZZ120010002.07.2021900
ZZZ12005003.07.2021850
ZZZ12002004.07.2021830

I want a measure to calculate me the substraction from the "TotalOnStock" which is always the same value on each row, with the summed up Reserve from the same or if available the sum from all dates before like the numbers in "RangeSum" column. 

 

Other than that I also need a measure for color formatting, when in RangeSum it becomes zero or less its red and when positiv number its green. For example like this with different numbers:

MaterialTotalOnStockReserveDateRangeSum
ZZZ120050001.07.2021700
ZZZ120040002.07.2021300
ZZZ120030003.07.20210
ZZZ12005004.07.2021-50

 

Thank you very much in advance. 

Best. 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Applicable88 , A new measure , Assume TotalOnStock  and Reserve are measures

 

RangeSum= [TotalOnStock] -calculate(sum([Reserve]), filter(allselected(Table), Table[Date] <= max(Table[Date])))

View solution in original post

v-xulin-mstf
Community Support
Community Support

Hi @Applicable88,

 

Try measure as:

Rangesum = 
CALCULATE(
    MAX('Table'[TotalOnStock])-SUM('Table'[Reserve]),
    FILTER(
        all('Table'),
        'Table'[Date]<=MAX('Table'[Date])
    )
)

And then set conditon formatting as:

vxulinmstf_0-1625732438522.pngvxulinmstf_1-1625732453419.png

Here is the output:

vxulinmstf_2-1625732539479.png

The pbix is attached.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

 

View solution in original post

2 REPLIES 2
v-xulin-mstf
Community Support
Community Support

Hi @Applicable88,

 

Try measure as:

Rangesum = 
CALCULATE(
    MAX('Table'[TotalOnStock])-SUM('Table'[Reserve]),
    FILTER(
        all('Table'),
        'Table'[Date]<=MAX('Table'[Date])
    )
)

And then set conditon formatting as:

vxulinmstf_0-1625732438522.pngvxulinmstf_1-1625732453419.png

Here is the output:

vxulinmstf_2-1625732539479.png

The pbix is attached.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

 

amitchandak
Super User
Super User

@Applicable88 , A new measure , Assume TotalOnStock  and Reserve are measures

 

RangeSum= [TotalOnStock] -calculate(sum([Reserve]), filter(allselected(Table), Table[Date] <= max(Table[Date])))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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