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
Anonymous
Not applicable

FIXED SUM

stock.PNG

i want to find out the sum of the stock except latest stock count(i.e latest stock count date is 4/28/2019)and previous stock count(i.e prevoious stock count date is 4/4/2019)

i want to find out the sum of the stock excpet mindate(i.e 4/4/2019) and maxdate(i.e 4/24/2019). i want the sum of remaining dates. the requrired output is as sales between latest and previous column.

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can create a new column to do it.

Column =
VAR mind =
    MIN ( test[date] )
VAR maxd =
    MAX ( test[date] )
RETURN
    IF (
        OR ( test[date] = mind, test[date] = maxd ),
        BLANK (),
        SUMX ( FILTER ( test, test[date] > mind && test[date] < maxd ), test[stock] )
    )

6-1.PNG

Or you can use a new measure to do it.

Measure 2 =
VAR mind =
    MIN ( test[date] )
VAR maxd =
    MAX ( test[date] )
RETURN
    CALCULATE ( SUM ( test[stock] ), test[date] > mind && test[date] < maxd )

6-2.PNG

 

Best Regards,

Eads

 

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

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can create a new column to do it.

Column =
VAR mind =
    MIN ( test[date] )
VAR maxd =
    MAX ( test[date] )
RETURN
    IF (
        OR ( test[date] = mind, test[date] = maxd ),
        BLANK (),
        SUMX ( FILTER ( test, test[date] > mind && test[date] < maxd ), test[stock] )
    )

6-1.PNG

Or you can use a new measure to do it.

Measure 2 =
VAR mind =
    MIN ( test[date] )
VAR maxd =
    MAX ( test[date] )
RETURN
    CALCULATE ( SUM ( test[stock] ), test[date] > mind && test[date] < maxd )

6-2.PNG

 

Best Regards,

Eads

 

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

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

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.