Forum Discussion

Datanik's avatar
Datanik
Frequent Visitor
3 years ago
Solved

Multi Date column in calculate

Hello, colleagues.
Please help me in solving my problem.
I have a spreadsheet with payments for different sales dates. I need to get payments for new sales and old sales within the current payment month.
payments table

model

visual

 

that's what I want to see in the matrix:
new deals - 4000
old deals - 6000 
tried to solve old deals via USERELATIONSHIP , but then the payment from the next month, the date of sale of which was in the current month, is received

file https://drive.google.com/file/d/1-bM1i6wADX595GuoDX8pvLoosgFo-7s_/view?usp=drive_link

  • I was able to find a solution after all. 
    thank you all

    payment n.d. = 
    VAR minDate = MINX( allselected('date') , 'date'[Date] )
    VAR maxDate = MAXX(allselected('date') , 'date'[Date] )
    RETURN
    CALCULATE([payment all], filter( deals_payments,deals_payments[date_deal] >=minDate && deals_payments[date_deal] <=maxDate))
    
    payment o.d. = [payment all] - [payment n.d.]
    
    payment all = SUM(deals_payments[amount])

1 Reply

  • Datanik's avatar
    Datanik
    Frequent Visitor

    I was able to find a solution after all. 
    thank you all

    payment n.d. = 
    VAR minDate = MINX( allselected('date') , 'date'[Date] )
    VAR maxDate = MAXX(allselected('date') , 'date'[Date] )
    RETURN
    CALCULATE([payment all], filter( deals_payments,deals_payments[date_deal] >=minDate && deals_payments[date_deal] <=maxDate))
    
    payment o.d. = [payment all] - [payment n.d.]
    
    payment all = SUM(deals_payments[amount])