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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
kolli002
New Member

I have a issue with DAX

Hello Team,

I hope everyone is doing well!

I am facing an issue in my report.

I am expecting the output as below:

  • Employee Name: Nellaiappan Gomathinayagam

  • Week: 4–10 → 2 Days, and 11–17 → 3 Days (Month: Aug 2025)

But currently, I am getting the output incorrectly:

  • Under week 4–10 → only 1 day is showing

  • Week 11–17 is missing completely

I have used the calculation shown below.
Could you please assist me in resolving this issue?


Date Table calculation:

DateTable =
ADDCOLUMNS (
    CALENDAR ( MIN ( Attendance[date] ), MAX ( Attendance[date] ) ),
    "Year", YEAR ( [Date] ),
    "Month", FORMAT ( [Date], "MMM yyyy" ),
    "Week Start", [Date] - WEEKDAY ( [Date], 2 ) + 1,   -- Monday
    "Week End", ([Date] - WEEKDAY ( [Date], 2 ) + 1) + 6,  -- Week Start + 6
    "Week Number", WEEKNUM ( [Date], 2 ),               -- Mon–Sun
    "YearWeek",
        YEAR ( [Date] - WEEKDAY ( [Date], 2 ) + 1 ) * 100
        + WEEKNUM ( [Date] - WEEKDAY ( [Date], 2 ) + 1, 2 )
)

Week Label: 
VAR StartOfWeek = 'DateTable'[Date] - WEEKDAY ( 'DateTable'[Date], 2 ) + 1
VAR EndOfWeek   = StartOfWeek + 6
RETURN
    FORMAT ( StartOfWeek, "DD" ) & " - "
    & FORMAT ( EndOfWeek, "DD" ) & ", "
    & FORMAT ( EndOfWeek, "MMM" )

Days Present per Week =
CALCULATE (
    DISTINCTCOUNT ( Attendance[Date] ),
    KEEPFILTERS ( VALUES ( DateTable[Date] ) )
)
Source data screen shot is below:
kolli002_1-1756096942130.png

Report output:

kolli002_2-1756097582185.png

Relation ship in Model:

kolli002_3-1756097702512.png

 



 

1 REPLY 1
FBergamaschi
Solution Sage
Solution Sage

Hi @kolli002,

without usable data, I can only suggest to use a simpler code

Days Present per Week =

DISTINCTCOUNT ( Attendance[Date] )

 

Does that work?

 

If not, 

can you please share the pbix via some cloud service? Or in alternative can you please include, in a usable format, not an image, a small set of rows for each of the tables involved in your request and show the data model in a picture, so that we can import the tables in Power BI and reproduce the data model. The subset of rows you provide, even is just a subset of the original tables, must cover your issue or question completely. Do not include sensitive information and do not include anything that is unrelated to the issue or question. Please show the expected outcome based on the sample data you provided and make sure, in case you show a Power BI visual, to clarify the columns used in the grouping sections of the visual.

 

Need help uploading data? click here

 

Want faster answers? click here

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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