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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
wujunmin
Advocate I
Advocate I

Custom Calendar Visual by DAX

wujunmin_0-1638087181817.png

First, creat a calendar table:

Calendar = 
ADDCOLUMNS(CALENDAR(DATE(2021,1,1),DATE(2021,12,31)),
    "Month",MONTH([Date]),
    "Day",DAY([Date]),
    "DDD",FORMAT([Date],"DDD"),
    "WeekDay",WEEKDAY([Date],2),
    "WeekNum",WEEKNUM([Date],2) 
)

Then, creat a svg measure, mark it as  image url: 

SVG_DAY = 
"data:image/svg+xml;utf8,"&"
<svg xmlns='http://www.w3.org/2000/svg' height='100' width='100'>"&
    IF(SELECTEDVALUE('Calendar'[Date])=TODAY(),"<circle cx='50' cy='50' r='40' fill='Tomato'/>",BLANK())&"
    <text x='50' y='50' font-size='30' text-anchor='middle' dominant-baseline='middle' fill='"&
        IF(SELECTEDVALUE('Calendar'[Date])=TODAY(),"White",IF(SELECTEDVALUE('Calendar'[WeekDay])>=6,"Grey","Black"))&"'>"&SELECTEDVALUE('Calendar'[Day])&"
    </text>
</svg> " 

Finally, a matrix:

wujunmin_1-1638087435873.png

 

0 REPLIES 0

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors