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
koray
Helper V
Helper V

I can't get the result as 21.5

Hello,

 

I have a table in my Excel file that shows the total working days of the month based on the date.

 

is_gunu.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I don't see the total number of working days as 21.5 in my report. That puts it at 22. How do I fix this?

 

sonuc.JPG

 

 

 

 

Thank you.

6 REPLIES 6
v-alq-msft
Community Support
Community Support

Hi, @koray 

 

I wonder what the measure is like. Based on your description, I created data to reproduce your scenario.

Table:

b1.png

 

Calendar(a calculated table):

 

Calendar = CALENDARAUTO()

 

 

There is no relationship between two tables.

 

You may create two measures as below. They are both set as decimal number.

 

Working Days = 
var _date = SELECTEDVALUE('Table'[Date])
var _year = YEAR(_date)
var _month = MONTH(_date)
var _result = 
CALCULATE(
    DISTINCTCOUNT('Calendar'[Date]),
    FILTER(
        ALL('Calendar'),
        YEAR('Calendar'[Date])=_year&&
        MONTH('Calendar'[Date])=_month&&
        NOT(WEEKDAY('Calendar'[Date]) in {1,7})&&
        'Calendar'[Date]<_date
    )
)
return
IF(
    ISBLANK(_result),
    0,
    _result
)

Remain Working Days = 
var _date = SELECTEDVALUE('Table'[Date])
var _year = YEAR(_date)
var _month = MONTH(_date)
var _result = 
CALCULATE(
    DISTINCTCOUNT('Calendar'[Date]),
    FILTER(
        ALL('Calendar'),
        YEAR('Calendar'[Date])=_year&&
        MONTH('Calendar'[Date])=_month&&
        NOT(WEEKDAY('Calendar'[Date]) in {1,7})
    )
)
return
_result-[Working Days]+0.5

 

 

Result:

b2.png

 

Best Regards

Allan

 

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

jptak
Helper I
Helper I

What is the data type set to for that column in Power BI? Looks like it may be set to Whole Number.

Hello,

 

I tried many option, but 😞

 

sonuc2.JPG

What is the data type in Power Query?

What should it be? I sent it in the first picture.

az38
Community Champion
Community Champion

@koray  hi

check:

a) Column tools ribbon for [Kalan Gun] column

b) Date type for  [Kalan Gun] in Power Query. It should be Decimal number


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.