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
ballist1x
Helper III
Helper III

Need help filtering dates with a Period slicer !

Hi all, i am trying to calculate a last period revenue figure, i.e sum the value of the sales of accounts b

 

H1[Final Amount] is the revenue (calculation)

H1[ posting date] are the order dates

Last Invoice Date = CALCULATE(MAX(H1[Posting Date]), ALLEXCEPT('H1', 'H1'[Customer Number]))

Select Period = IF(countrows(Period)=1, MAX(Period[Period]),BLANK())

 

period table is a table with 30, 60, 90, 120, 365 etc

 

i want to sum all the the Final Amount (£) for the date between Today minus the selected period, i.e 30 so today - 30 days and return the summed final amount of the accounts if the Today - 30 (for example)

 

 

this is my calculation but it doesnt return the results that i want:(

 

Last Period Revenue = CALCULATE(sum(H1[Final Amount (£)]), DATESBETWEEN(H1[Posting Date], DATEADD(LASTDATE(H1[Today]), -1*[Select Period], DAY), LASTDATE(H1[last invoice date])))

6 REPLIES 6
ballist1x
Helper III
Helper III

if anyone can help to come up with a solution that would be great!

 

 

Hi @ballist1x,

 

Maybe you can try to use below measure if it works for your requirement:

Last Period Revenue =
VAR currentDate =
    MAX ( H1[Posting Date] )
RETURN
    CALCULATE (
        SUM ( H1[Final Amount (£)] ),
        FILTER (
            ALLSELECTED ( H1 ),
            Hi[Posting Date]
                >= currentDate - MIN ( [Select Period], 0 )
                && Hi[Posting Date] <= LASTDATE ( VALUES ( H1[last invoice date] ) )
        )
    )

If not help, please share sample or pbix file with expected results.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft

Hi unfortunately that just loops and doesnt provide a calulation.

HI @ballist1x,

 

I'd like some sample data for test.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft

 

for example

 

YEAR_ENDINGPERIODPOSTING_DATENAV_NO_CODENAV_NO_DESCRIPTIONCustomer NumberCustomerDOCUMENT_NOQUANTITYRevenueCUSTOMER_NAMEMANUFACTURERRevenue GroupHierarchy Level 3
2018101/01/2018NX-11111HeinzACC155 INVOICE123120NewciHeinzeCONDIMENTSTEA
2018101/03/2018KTCH1KetchACC155 INVOICE125115DALEHeinzeCONDIMENTSLUNCH
2018101/01/2018SLDCRM1SALADACC156 INVOICE1266200BOROMWORCESTERCONDIMENTSLUNCH

HI @ballist1x,

 

Maybe you can take a look at following link:

Slicers For Selecting Last "X" Periods

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.