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
Serdet
Post Patron
Post Patron

DAX FILTERS

Hi All,

 

I have four columns as per the below example.

 

Priorty ValvesRequired Work DateActual Work DatePercentage Complete
1a01/01/202101/01/2021100%
1b05/01/202108/01/202150%
1c20/01/2021 0%

 

I want to show monthly based compliance between what has been worked compared to the required. This calculation will be 

 

A / B * 100

 

A = Count of 'Priority Valves' column, filtered by 'Required Work Day'(This Month) & 'Percentage Complete'(100%)
B =  Count of 'Priority Valves' column, filtered by 'Required Work Day'(This Month)

 

Any ideas on how I can achieve this within DAX?

 

Many thanks,

 

Elliot 

1 ACCEPTED SOLUTION
v-yetao1-msft
Community Support
Community Support

Hi @Serdet 

(1)First you need create a calendar date table .Then create a calculated column to extract the month number for the calendar date .

Ailsamsft_0-1624253201198.png

(2)Then create measures filtered by 'Required Work Day'(This Month) .

A = IF(MONTH(SELECTEDVALUE('Table'[Required Work Date]))=SELECTEDVALUE('Calendar Date'[Month number]) && SELECTEDVALUE('Table'[Percentage Complete])=1 ,1,0)

B = IF(MONTH(SELECTEDVALUE('Table'[Required Work Date]))=SELECTEDVALUE('Calendar Date'[Month number]),1,0)

(3)sum the value return from IF dax .

count A = SUMX('Table',[A])

count B = SUMX('Table',[B])

The final result is as shown :

Ailsamsft_1-1624253201200.png

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

 

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

View solution in original post

1 REPLY 1
v-yetao1-msft
Community Support
Community Support

Hi @Serdet 

(1)First you need create a calendar date table .Then create a calculated column to extract the month number for the calendar date .

Ailsamsft_0-1624253201198.png

(2)Then create measures filtered by 'Required Work Day'(This Month) .

A = IF(MONTH(SELECTEDVALUE('Table'[Required Work Date]))=SELECTEDVALUE('Calendar Date'[Month number]) && SELECTEDVALUE('Table'[Percentage Complete])=1 ,1,0)

B = IF(MONTH(SELECTEDVALUE('Table'[Required Work Date]))=SELECTEDVALUE('Calendar Date'[Month number]),1,0)

(3)sum the value return from IF dax .

count A = SUMX('Table',[A])

count B = SUMX('Table',[B])

The final result is as shown :

Ailsamsft_1-1624253201200.png

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

 

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.