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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

DAX - Dividing value (current date) by value (first date that appears for the month)

Hello everyone,

 

I'm trying to create a measure to divide quantity value of the current date by the value of the first date that appears forthe month. 

(e.g. 31 May Item A quantity value divided by 17 May Item A quantity value)
(e.g. 24 May Item A quantity value divided by 17 May Item A quantity value)
(e.g. 17 May Item A quantity value divided by 17 May Item A quantity value)

blueraccoon_1-1624432427645.png

 

Thanks in advance!

 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Anonymous,

 

Try this measure:

 

Percentage = 
VAR vCurrentQty =
    SUM ( 'Item'[Quantity] )
VAR vCurrentYear =
    YEAR ( MAX ( 'Item'[Date] ) )
VAR vCurrentMonth =
    MONTH ( MAX ( 'Item'[Date] ) )
VAR vFirstDateInMonth =
    CALCULATE (
        MIN ( 'Item'[Date] ),
        ALLEXCEPT ( 'Item', 'Item'[Item] ),
        YEAR ( 'Item'[Date] ) = vCurrentYear,
        MONTH ( 'Item'[Date] ) = vCurrentMonth
    )
VAR vEarliestQtyInMonth =
    CALCULATE (
        SUM ( 'Item'[Quantity] ),
        ALLEXCEPT ( 'Item', 'Item'[Item] ),
        'Item'[Date] = vFirstDateInMonth
    )
VAR vResult =
    DIVIDE ( vCurrentQty, vEarliestQtyInMonth )
RETURN
    vResult

 

DataInsights_0-1624540562525.png

Sample data:

 

DataInsights_1-1624540577742.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

@Anonymous,

 

Try this measure:

 

Percentage = 
VAR vCurrentQty =
    SUM ( 'Item'[Quantity] )
VAR vCurrentYear =
    YEAR ( MAX ( 'Item'[Date] ) )
VAR vCurrentMonth =
    MONTH ( MAX ( 'Item'[Date] ) )
VAR vFirstDateInMonth =
    CALCULATE (
        MIN ( 'Item'[Date] ),
        ALLEXCEPT ( 'Item', 'Item'[Item] ),
        YEAR ( 'Item'[Date] ) = vCurrentYear,
        MONTH ( 'Item'[Date] ) = vCurrentMonth
    )
VAR vEarliestQtyInMonth =
    CALCULATE (
        SUM ( 'Item'[Quantity] ),
        ALLEXCEPT ( 'Item', 'Item'[Item] ),
        'Item'[Date] = vFirstDateInMonth
    )
VAR vResult =
    DIVIDE ( vCurrentQty, vEarliestQtyInMonth )
RETURN
    vResult

 

DataInsights_0-1624540562525.png

Sample data:

 

DataInsights_1-1624540577742.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thank you for your help kind sir, have a good weekend 😉

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors