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
Pikachu-Power
Impactful Individual
Impactful Individual

measure relative value dont work

Hi all,

 

i have the following dax code where i try to calculate a relative value in a table:

 

 

Measure_count_entry_relative:

VAR CurrentCount =  CALCULATE(COUNT(MEMBER[ENTRYDATE]), 
                              FILTER(MEMBER, YEAR(MEMBER[ENTRYDATE]) = YEAR(MEMBER[date_endofmonth]) &&
                                             MONTH(MEMBER[ENTRYDATE]) = MONTH(MEMBER[date_endofmonth])),
                              MEMBER[AGE_ENTRYDATE] >= 18 && MEMBER[AGE_ENTRYDATE] <= 94)

VAR TotalCount = CALCULATE(COUNT(MEMBER[ENTRYDATE]), 
                           FILTER(MEMBER, YEAR(MEMBER[ENTRYDATE]) = YEAR(MEMBER[date_endofmonth]) &&
                                          MONTH(MEMBER[ENTRYDATE]) = MONTH(MEMBER[date_endofmonth])),
                           MEMBER[AGE_ENTRYDATE] >= 18 && MEMBER[AGE_ENTRYDATE] <= 94,
                           ALL(MEMBER[CLUSTER_ENTRYDATE]))

RETURN
DIVIDE(CurrentCount, TotalCount, 0)

 

 

But i get 100% instead of the relative value:

 

cluster.PNG

 

 

I use ALL(MEMBER[CLUSTER_ENTRYDATE]) to ignore the rows CLUSTER_ENTRYDATE but it seems not to work in this case. In other measures it worked normally. Does someone see why this dont work??

 

Many thanks!

 

Best regards 

Pikachu-Power

 

1 ACCEPTED SOLUTION
Pikachu-Power
Impactful Individual
Impactful Individual

One way it seems to work. When i create a new table 

 

        FILTER(
            MEMBER, YEAR(MEMBER[ENTRYDATE]) = YEAR(MEMBER[date_endofmonth]) &&
                    MONTH(MEMBER[ENTRYDATE]) = MONTH(MEMBER[date_endofmonth])

 

and remove this part from the measure than i get the right values. So the error must be here somewhere.

View solution in original post

4 REPLIES 4
Pikachu-Power
Impactful Individual
Impactful Individual

One way it seems to work. When i create a new table 

 

        FILTER(
            MEMBER, YEAR(MEMBER[ENTRYDATE]) = YEAR(MEMBER[date_endofmonth]) &&
                    MONTH(MEMBER[ENTRYDATE]) = MONTH(MEMBER[date_endofmonth])

 

and remove this part from the measure than i get the right values. So the error must be here somewhere.

Pikachu-Power
Impactful Individual
Impactful Individual

Still 100% when i use REMOVEFILTERS. No change. I work with real data and no dummy data.

 

The years in the column come from the calender table which is connected with MEMBER[ENTRYDATE]. I dont know if there is maybe a problem.

sanalytics
Super User
Super User

@Pikachu-Power 

Replace ALL(MEMBER[CLUSTER_ENTRYDATE]) with REMOVEFILTERS(MEMBER[CLUSTER_ENTRYDATE]) to remove the filter more effectively while calculating the total count.

Use the below DAX

Measure_count_entry_relative :=  
DIVIDE(
    CALCULATE(
        COUNT(MEMBER[ENTRYDATE]), 
        FILTER(
            MEMBER, YEAR(MEMBER[ENTRYDATE]) = YEAR(MEMBER[date_endofmonth]) &&
                    MONTH(MEMBER[ENTRYDATE]) = MONTH(MEMBER[date_endofmonth])
        ),
        MEMBER[AGE_ENTRYDATE] >= 18 && MEMBER[AGE_ENTRYDATE] <= 94
    ),
    CALCULATE(
        COUNT(MEMBER[ENTRYDATE]), 
        FILTER(
            MEMBER, YEAR(MEMBER[ENTRYDATE]) = YEAR(MEMBER[date_endofmonth]) &&
                    MONTH(MEMBER[ENTRYDATE]) = MONTH(MEMBER[date_endofmonth])
        ),
        MEMBER[AGE_ENTRYDATE] >= 18 && MEMBER[AGE_ENTRYDATE] <= 94,
        REMOVEFILTERS(MEMBER[CLUSTER_ENTRYDATE])
    ),
    0
)

if it does not work. I suggest you to provide some dummy data with your pbix file to test.

 

Regards

sanalytics

If it is your solution then please like and accept it as solution

 

bhanu_gautam
Super User
Super User

@Pikachu-Power , Try using 

 

Measure_count_entry_relative :=
VAR CurrentCount = CALCULATE(
COUNT(MEMBER[ENTRYDATE]),
FILTER(
MEMBER,
YEAR(MEMBER[ENTRYDATE]) = YEAR(MEMBER[date_endofmonth]) &&
MONTH(MEMBER[ENTRYDATE]) = MONTH(MEMBER[date_endofmonth])
),
MEMBER[AGE_ENTRYDATE] >= 18 && MEMBER[AGE_ENTRYDATE] <= 94
)

VAR TotalCount = CALCULATE(
COUNT(MEMBER[ENTRYDATE]),
FILTER(
MEMBER,
YEAR(MEMBER[ENTRYDATE]) = YEAR(MEMBER[date_endofmonth]) &&
MONTH(MEMBER[ENTRYDATE]) = MONTH(MEMBER[date_endofmonth])
),
MEMBER[AGE_ENTRYDATE] >= 18 && MEMBER[AGE_ENTRYDATE] <= 94,
REMOVEFILTERS(MEMBER[CLUSTER_ENTRYDATE])
)

RETURN
DIVIDE(CurrentCount, TotalCount, 0)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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