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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Dynamic Dates & Value Difference

Hello,

 

I want to provide a comparison of sales value as of each date. 

 

Example:

Report DateContracts Value
16/06/202110500
20/06/202113100
29/06/20219800
...etc...etc

 

The user will select two dates to compare (for example he will select 16/06/2021 & 20/06/2021). Note that there are also columns showing contract #, customer name, etc. In the table below - to keep it simple - I showed the aggregated values.

 

I have created a measure below:

 

New Contracts Financial Reporting =
VAR _minDate = min(Portfolio[Report Date])
VAR _maxDate = max(Portfolio[Report Date])
VAR _minDateValue = calculate([Annualized Value],Portfolio[Report Date]=_minDate)
VAR _maxDateValue = calculate([Annualized Value],Portfolio[Report Date]=_maxDate)
RETURN
_maxDateValue-_minDateValue

 

 

This measure works fine with a bar chart with Customer Name on the Axis and above measure as values. I have created two bar charts like this.

 

The first one is filtered (filter pane) with the condition "New Contracts Financial Reporting is less than 0", the other one is filtered with "New Contracts Financial Reporting is greater than 0".

 

So I have the evolution between two dates selected by user broken down by customer (I can see where contract/sales value has been increased and decreased).

 

What I would also like to get is a summary in CARD visuals. Similar to bar charts, the first card should show the sum of increased contracts/sales and the second card should show the sum of decreased contracts. I cannot apply the same filter on the measure as I did on the bar chart.

 

I believe I would need to create a new measure, can someone help with this?

1 ACCEPTED SOLUTION
daxer-almighty
Solution Sage
Solution Sage

[Positive Diffs Total] =
SUMX(
    SUMMARIZE(
        FactTable,
        // This CustomerID must be
        // unique. It's the key to
        // the Customer dimension.
        Customers[CustomerID]
    ),
    MAX(
        // blank is treated as 0
        // but will not display
        BLANK(), 
        [New Contracts Financial Reporting] 
    )
)

[Negative Diffs Total] =
SUMX(
    SUMMARIZE(
        FactTable,
        // This CustomerID must be
        // unique. It's the key to
        // the Customer dimension.
        Customers[CustomerID]
    ),
    MIN(
        // blank is treated as 0
        // but will not display
        BLANK(), 
        [New Contracts Financial Reporting] 
    )
)

View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can use the following two measures for two cards:

increased contracts = SUMX(FILTER( SUMMARIZE(FactTable,FactTable[CustomerID],"_increasedvalue",[New Contracts Financial Reporting]),[_increasedvalue]>=0),[_increasedvalue])

Decreased contracts = SUMX(FILTER( SUMMARIZE(FactTable,FactTable[CustomerID],"_decreasedvalue",[New Contracts Financial Reporting]),[_decreasedvalue]<=0),[_decreasedvalue])

 

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

 

Best Regards,

Dedmon Dai

 

daxer-almighty
Solution Sage
Solution Sage

[Positive Diffs Total] =
SUMX(
    SUMMARIZE(
        FactTable,
        // This CustomerID must be
        // unique. It's the key to
        // the Customer dimension.
        Customers[CustomerID]
    ),
    MAX(
        // blank is treated as 0
        // but will not display
        BLANK(), 
        [New Contracts Financial Reporting] 
    )
)

[Negative Diffs Total] =
SUMX(
    SUMMARIZE(
        FactTable,
        // This CustomerID must be
        // unique. It's the key to
        // the Customer dimension.
        Customers[CustomerID]
    ),
    MIN(
        // blank is treated as 0
        // but will not display
        BLANK(), 
        [New Contracts Financial Reporting] 
    )
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.