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
ramkula123
Helper I
Helper I

DAX calculation

Hi All, 

 

I need to calculate the difference (in weeks) between weekdays i.e today and weekday (ex : 201920). I have values like 201919,201920,201921 etc in column A in my table .

The expected result is ,if Column A has value 201921 then result should be -1 as we are 201922 week currently .

 

Thank you.

4 REPLIES 4
v-xicai
Community Support
Community Support

Hi @ramkula123 ,

 

You can try to create column like DAX below.

 

Column1= VALUE(MID(Table1[Column A],5,2))-WEEKNUM(TODAY())

 

Best Regards,

Amy

 

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

 

@v-xicai Thanks for inputs ! 🙂 

But I have older weeks as well in my column A . I have values like 201821, 201822 etc .

Hence I need to calculate the difference in weeks from 2017 ,2018 to current week. 

Hi @ramkula123 ,

 

Yes, I know your demand. Did the DAX formula fail to meet your demand? Or could you please share your sample data or desired output screenshots for further analysis?

 

Best Regards,

Amy

Hi @v-xicai 



Please find the screenshot . I have put 3 columns : Input data , Result expected , The result which I am getting using the formula above .

 

PBI community.PNG

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.