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
queryuser
Helper I
Helper I

How to display which Product sales exceed forecast based on - first date when sales exceed forecast

Dear Community,

 

You could know the answer to this question.

 

I need a card to display which product exceeds forecasted sales based on the date it happened.

 

Below you can see the calculations made to get the first date when either of products exceeds demand. (this works)

 

The issue is that:

1. product names are colums 

2. there are more products C, D, E etc.(which are out of scope) and either Product A or B needs to show up

 

Card 5 Capacity.PNG

 

Many thanks in advance!

 

Kind regards

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @queryuser ,

 

I create some example data to show your problems. And i used the following code which you can refer it in the pbix which in the end.

 

Card 1 sales exceeds forecasted =
VAR _A =
    SUMMARIZE( ALL( 'sales' ), [Product], "SUMP", SUM( sales[Sales] ) )
VAR _B =
    ADDCOLUMNS(
        _A,
        "IF", IF( [SUMP] >= SELECTEDVALUE( forecast[forecasted sales] ), 1, BLANK() )
    )
RETURN
    CALCULATE( MIN( 'sales'[date] ), FILTER( _B, [IF] = 1 ) )

 

Result:

vchenwuzmsft_0-1639994090311.png

If you need more help please share some example data.


Best Regards

Community Support Team _ chenwu zhu

 

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

 

View solution in original post

4 REPLIES 4
v-chenwuz-msft
Community Support
Community Support

Hi @queryuser ,

 

I create some example data to show your problems. And i used the following code which you can refer it in the pbix which in the end.

 

Card 1 sales exceeds forecasted =
VAR _A =
    SUMMARIZE( ALL( 'sales' ), [Product], "SUMP", SUM( sales[Sales] ) )
VAR _B =
    ADDCOLUMNS(
        _A,
        "IF", IF( [SUMP] >= SELECTEDVALUE( forecast[forecasted sales] ), 1, BLANK() )
    )
RETURN
    CALCULATE( MIN( 'sales'[date] ), FILTER( _B, [IF] = 1 ) )

 

Result:

vchenwuzmsft_0-1639994090311.png

If you need more help please share some example data.


Best Regards

Community Support Team _ chenwu zhu

 

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

 

Hi _ chenwu zhu,

 

Thank you for your reply. The difference is that the table in Power BI is as displayed.

 

Prod A / Prod B as columns - in your .pbix the 'Sales' is in one culmn

 

How would you combined those columns into 1 ?

 

 

Hi @queryuser ,

 

You mean you want to change multiply colums to one column?

vchenwuzmsft_0-1640166288309.png

---->>>

vchenwuzmsft_1-1640166339447.png

 

You can use unpiovt columns function ( in power query editorvchenwuzmsft_3-1640166665563.png).

vchenwuzmsft_2-1640166421678.png

 


Best Regards

Community Support Team _ chenwu zhu

 

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

 

 

 

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. Paste the data into a table in your post or use one of the file services. 

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.