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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.