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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.