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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
MostafaGamal
Helper V
Helper V

How to inset Dynamic Value in calculated column formula

Hi All, I use the following formula to return data from another table and save it to another table 

BOS Submitted = 
VAR m = Mails[Mail]
RETURN
IF(
CALCULATE(
    DISTINCTCOUNT(BOSResponses[SubmittedOn]),
    FILTER(ALL(Mails),
    Mails[Mail] = m
    ), Filter(BOSResponses, AND(BOSResponses[SubmittedOn]<=DATE(2020,07,31),BOSResponses[SubmittedOn]>=Date(2020,07,01)))
)>=2,1,IF(
CALCULATE(
    DISTINCTCOUNT(BOSResponses[SubmittedOn]),
    FILTER(ALL(Mails),
    Mails[Mail] = m
    ), Filter(BOSResponses, AND(BOSResponses[SubmittedOn]<=Date(2020,07,31),BOSResponses[SubmittedOn]>=Date(2020,07,01)))
)>=1,0.5,0)  ) 

 Kindly note the date values in this DAX formula is manually choosen by the creator of the report, how to make this value choosen by the user who use the report ( like time slicer ) ?? 

 

Capture.PNG

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

Hi @MostafaGamal ,

 

Sorry for that dynamic display of calculated columns is not allowed.

We suggest to create a table visual and a measure to show the result.

First you need to create a date table that has no relationship with other tables. You can add it to a slicer.

Then you can create a measure refer this formula.

 

BOS Submitted =
VAR m =
    MAX ( Mails[Mail] )
VAR _min_date =
    MIN ( 'Date'[Date] )
VAR _max_date =
    MAX ( 'Date'[Date] )
RETURN
    IF (
        CALCULATE (
            DISTINCTCOUNT ( BOSResponses[SubmittedOn] ),
            FILTER ( ALL ( Mails ), Mails[Mail] = m ),
            FILTER (
                BOSResponses,
                AND (
                    BOSResponses[SubmittedOn] <= _max_date,
                    BOSResponses[SubmittedOn] >= _min_date
                )
            )
        ) >= 2,
        1,
        IF (
            CALCULATE (
                DISTINCTCOUNT ( BOSResponses[SubmittedOn] ),
                FILTER ( ALL ( Mails ), Mails[Mail] = m ),
                FILTER (
                    BOSResponses,
                    AND (
                        BOSResponses[SubmittedOn] <= _max_date,
                        BOSResponses[SubmittedOn] >= _min_date
                    )
                )
            ) >= 1,
            0.5,
            0
        )
    )

 

HOW1.jpg

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

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

8 REPLIES 8
v-zhenbw-msft
Community Support
Community Support

Hi @MostafaGamal ,

 

How about the result after you follow the suggestions mentioned in my original post?

Could you please provide more details or expected result about it If it doesn't meet your requirement?

If you've fixed the issue on your own please kindly share your solution.

 

Best regards,

 

Community Support Team _ zhenbw

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

@v-zhenbw-msft  i have create a new table called date and use your formula but all the outcome of the formula are " 0 " no data comes from the calculated coulmn 

Hi @MostafaGamal ,

 

Please check that the new Date table you created is not related to other tables.

If it doesn't work, could you please provide a mockup sample based on fake data?

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

Best regards,

 

Community Support Team _ zhenbw

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

v-zhenbw-msft
Community Support
Community Support

Hi @MostafaGamal ,

 

Sorry for that dynamic display of calculated columns is not allowed.

We suggest to create a table visual and a measure to show the result.

First you need to create a date table that has no relationship with other tables. You can add it to a slicer.

Then you can create a measure refer this formula.

 

BOS Submitted =
VAR m =
    MAX ( Mails[Mail] )
VAR _min_date =
    MIN ( 'Date'[Date] )
VAR _max_date =
    MAX ( 'Date'[Date] )
RETURN
    IF (
        CALCULATE (
            DISTINCTCOUNT ( BOSResponses[SubmittedOn] ),
            FILTER ( ALL ( Mails ), Mails[Mail] = m ),
            FILTER (
                BOSResponses,
                AND (
                    BOSResponses[SubmittedOn] <= _max_date,
                    BOSResponses[SubmittedOn] >= _min_date
                )
            )
        ) >= 2,
        1,
        IF (
            CALCULATE (
                DISTINCTCOUNT ( BOSResponses[SubmittedOn] ),
                FILTER ( ALL ( Mails ), Mails[Mail] = m ),
                FILTER (
                    BOSResponses,
                    AND (
                        BOSResponses[SubmittedOn] <= _max_date,
                        BOSResponses[SubmittedOn] >= _min_date
                    )
                )
            ) >= 1,
            0.5,
            0
        )
    )

 

HOW1.jpg

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

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

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @MostafaGamal ,

 

I think you're looking for a what-if parameter.

https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-what-if

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


@mwegener  What IF Paremeter does not allow me to create a date parmeter 

its only whole of decimal number 

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @MostafaGamal 

 

You are right, but the concept is quickly transferred. (See attached PBIX)

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


vanessafvg
Super User
Super User

are you looking for this? selectedvalue() to get the value from your slicers? https://www.sqlbi.com/articles/using-the-selectedvalue-function-in-dax/




If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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