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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

how to display the measure for the day when filtering for the month

I have two measures:

  1. Number of total working days in the month 
  2. Sum of the number of working days for a given day in the month

I would like to create a third measure

     3. Left working days

 

It's easy:

1 - 2 = 3


The measure created in this way works correctly at the level of detail of the day or month.

The challenge is how to display this measure on the card for the current day, while the data is filtered to the entire current month?

 

Example:
Current day: 2019-11-21

1. 19

2. 13

3. 6

 

 

Filtering the data range to the whole month, the card presents the value 0 instead of 6.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @V-lianl-msft 

Thank you for your support!

Unfortunately, the solution proposed does not work correctly for that problem.

 

I wrote another measure:

(related to my first post)

 

Measure = 
VAR MaxDate = MAX(D_Dates[Date])
VAR CurrentDate = TODAY()

Return

IF(
    [1] = [2];

    CALCULATE(COUNTROWS(D_Dates);
                D_Dates[Year]  = YEAR(MaxDate);
                D_Dates[Month] = MONTH(MaxDate);
                D_Dates[Date]  > CurrentDate;
                D_Dates[IsWorkDay] = 1);
    
    [3]
    )

 

This is probably not the optimal solution, but it solves the problem 🙂

View solution in original post

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your description, I think the DAX of the second measure is incorrect.Please try this below:

 

Measure 2 = CALCULATE(SUM(D_Dates[IsWorkDay]),FILTER(ALLSELECTED(D_Dates),D_Dates[IsWorkDay]=1))

 

If the result is not what you want,please provide the measure with DAX and try to provide sample data of the table.

 

Best Regards,

Liang

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

Anonymous
Not applicable

Hello @V-lianl-msft 

Thank you for your support!

Unfortunately, the solution proposed does not work correctly for that problem.

 

I wrote another measure:

(related to my first post)

 

Measure = 
VAR MaxDate = MAX(D_Dates[Date])
VAR CurrentDate = TODAY()

Return

IF(
    [1] = [2];

    CALCULATE(COUNTROWS(D_Dates);
                D_Dates[Year]  = YEAR(MaxDate);
                D_Dates[Month] = MONTH(MaxDate);
                D_Dates[Date]  > CurrentDate;
                D_Dates[IsWorkDay] = 1);
    
    [3]
    )

 

This is probably not the optimal solution, but it solves the problem 🙂

Hi @Anonymous ,

 

It's glad that you have solved your problem.
Please accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

Best Regards,

Liang

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.