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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Alternative DAX Formula

Hi Everyone,

Currently I am using one formula to find the closed deals based on date.

I have created a stacked bar chart which can give the closed deals count based on date.

I have used this formula " 

CALCULATE(DISTINCTCOUNT(pred[deal]) ,pred[ACTUAL_STATUS(deal_status)] <> "Open"FILTER(pred,pred[PREDICTION_DATE] = CALCULATE(max(pred[PREDICTION_DATE]),ALLEXCEPT(pred,pred[deal])))) " 
I am gettng the accurate data, but this caluclation is taking more time to load the visual.
 
Can anyone suggest alternative formula for the above mentioned?
 
Thanks in advance.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for your hep and it resolved now. I used different aproach to solve it

CALCULATE (
DISTINCTCOUNT (pred[deal] ),
pred[ACTUAL_STATUS] <> "Open",keepfilters(filter(pred, pred[MAX_CLOSED_DATE]=pred[PREDICTION_DATE])))

View solution in original post

8 REPLIES 8
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous 

 

If your problem has been solved, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

 

Refer to:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,

Jianbo Li

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

johnt75
Super User
Super User

You could try

Closed deals =
VAR DealAndDate =
    ADDCOLUMNS (
        VALUES ( pred[deal] ),
        "@date", CALCULATE ( MAX ( pred[PREDICTION_DATE] ) )
    )
VAR Result =
    CALCULATE (
        DISTINCTCOUNT ( pred[deal] ),
        pred[ACTUAL_STATUS(deal_status)] <> "Open",
        DealAndDate
    )
RETURN
    Result
Anonymous
Not applicable

Thanks for your response, it is giving the total count correctly. But when you plot the visual ( stacked bar: date: X-axis, Cout- Y-axis)it is not giving the exact count of deals which got closed on perticular date.
It is showing as summation for previous days count

is it possible to share a PBIX with any confidential information removed ?

Anonymous
Not applicable

Sorry to say, It's highly confidential data

what relationships do you have from your date table to the predictions table ? on which columns and are they one-to-many or many-to-many? in which directions do the filters flow ?

Anonymous
Not applicable

Its a single table, no other tables 

Anonymous
Not applicable

Thanks for your hep and it resolved now. I used different aproach to solve it

CALCULATE (
DISTINCTCOUNT (pred[deal] ),
pred[ACTUAL_STATUS] <> "Open",keepfilters(filter(pred, pred[MAX_CLOSED_DATE]=pred[PREDICTION_DATE])))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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