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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
IAM
Helper III
Helper III

Calculated column to meausure (because of use parameter)

Hi alll,

 

I have a calculated column:

 

Recurring =
 VAR CurrPrc = 'Export'[Object]
 VAR CurrDate = 'Export'[Date created]
  RETURN
  COUNTROWS(
       FILTER(
           ALL('Export'),
           CurrPrc = 'Export'[Object] &&
           'Export'[Object] <> "" &&
           'Export'[Date created] > CurrDate - 30 &&
           'Export'[Date created] < CurrDate + 30)
       )
 
Now I want to change the number 30 into the value giving with the parameter
NumDays[Waarde van NumDays]
 
This is not possible with a calculated column, I know that, but is there a way to change the DAX into a measure so I can use it?
The calculated column accepted the code, but the measure not.
 
 VAR CurrPrc = 'Export'[Object]
 VAR CurrDate = 'Export'[Date created]
  RETURN
  COUNTROWS(
       FILTER(
           ALL('Export'),
           CurrPrc = 'Export'[Object] &&
           'Export'[Object] <> "" &&
           'Export'[Date created] > CurrDate - NumDays[Waarde van NumDays] &&
           'Export'[Date created] < CurrDate + NumDays[Waarde van NumDays] )
       )
 
Does anyone know?
1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @IAM 

 

Please try this DAX for a measure. Add 'Export'[Object] and 'Export'[Date created] columns to the same visual as well as this measure. 

Recurring =
VAR dayParameter = [Waarde van NumDays]
VAR CurrPrc = SELECTEDVALUE ( 'Export'[Object] )
VAR CurrDate = SELECTEDVALUE ( 'Export'[Date created] )
RETURN
    COUNTROWS (
        FILTER (
            ALL ( 'Export' ),
            CurrPrc = 'Export'[Object]
                && 'Export'[Object] <> ""
                && 'Export'[Date created] > CurrDate - dayParameter
                && 'Export'[Date created] < CurrDate + dayParameter
        )
    )

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @IAM 

 

Please try this DAX for a measure. Add 'Export'[Object] and 'Export'[Date created] columns to the same visual as well as this measure. 

Recurring =
VAR dayParameter = [Waarde van NumDays]
VAR CurrPrc = SELECTEDVALUE ( 'Export'[Object] )
VAR CurrDate = SELECTEDVALUE ( 'Export'[Date created] )
RETURN
    COUNTROWS (
        FILTER (
            ALL ( 'Export' ),
            CurrPrc = 'Export'[Object]
                && 'Export'[Object] <> ""
                && 'Export'[Date created] > CurrDate - dayParameter
                && 'Export'[Date created] < CurrDate + dayParameter
        )
    )

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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