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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

% Calculation in DAX with detail data

We have a data as below, so I would like to calculate the % based on status (R) availability with in a week

For ex for the meter number 214243107 then R available 4 times in a week, so the cal will be 4/7*100, same way need to display % for othres

 

hanurao_0-1626267489941.png

Format needs to be displayed exactly below , will this possible by wringing some DAX measure ??

hanurao_1-1626267520442.png

 

 

 

 
3 REPLIES 3
hanuraolm
Helper I
Helper I

Thanks, Kim for sharing the file and it's really helpful to understand the code & intermediate tables to solve the issue

hanuraolm
Helper I
Helper I

thanks, Kim for the details

here we are extracting different weeks' data, if we select the next week then it should display all dates for that week.

 

tried to generate an intermediate table based on the main data as you pointed.

Table =
var _Temptable = SUMMARIZECOLUMNS(Data[Date])
return
UNION(
SELECTCOLUMNS(_Temptable,"Date",Data[Date],"Column",FORMAT(Data[Date],"dd-mmm")),
ROW("Date",BLANK(),"Colun","%")
)
 
1. unable to generate a sequence

2. without seq used these columns in measures then it's given weird numbers.

measure changed as per the above table result as below 
hanuraolm_0-1626318469672.png

 

Jihwan_Kim
Super User
Super User

Picture1.png

 

Result measure : =
VAR _connectingtable =
TREATAS ( VALUES ( Columns_2[Date] ), Data[Date] )
VAR _rcount =
CALCULATE ( COUNTROWS ( Data ), Data[Value] = "r" )
VAR _allcount =
COUNTROWS ( Data )
RETURN
SWITCH (
SELECTEDVALUE ( Columns_2[Column] ),
"%", DIVIDE ( _rcount, _allcount ) * 100,
CALCULATE ( SELECTEDVALUE ( Data[Value] ), _connectingtable )
)

 

 

Link to the pbix file 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.