Tuesday, 1 July 2025

Multiply & divide with One column & one measure

  • Below [RCTQTY] is a column & [Sampling Measure] is a measure
Expected Uploads Measure1 =
SUMX(
    Receipts_SAP,
    Receipts_SAP[RCTQTY] * [Sampling Measure]
)

  • Below [SN_Count] is a column & [Expected Uploads Measure1] is a measure
Upload Percentage =
DIVIDE(SUM(Receipts_LSQD[SN_Count]), [Expected Uploads Measure1])




Saturday, 21 June 2025

DAX Measure to calculate % of tickets closed within TAT

 %TICKETS_CLOSED_WITHIN_TAT(%Success) =

VAR FilteredTable =
    FILTER(
        'Closed,Rejected',
        'Closed,Rejected'[TAT_Closed_Req] = "Within TAT" //[TAT_Closed_Req] Is a measure
    )
RETURN
DIVIDE(
    CALCULATE(COUNT('Closed,Rejected'[Id]), FilteredTable),
    CALCULATE(COUNT('Closed,Rejected'[Id]))
)




Create Button Slicer for Monthly, Weekly & yearly Data

Video Ref:

https://www.youtube.com/watch?v=NA8KcFgxrG0


Step-1:
  • Modelling  > New Parameter > Fields
Step-2:
    • Select the parameters for Monthly,Weekly,Yearly as shown below
    Step-3:

        • After this, Insert button slicer and click on the parameter name which you created.


        Wednesday, 18 June 2025

        Ageing calculation using DAX

        • In the Below DAX function we are calculating ageing only for the tickets which are open.
        • If the Ticket is closed, then it is mentioned as "NA


        DAX Code

        Ageing Working Days =

        var status1=SELECTEDVALUE(Main[Status])
        RETURN
        if(
            status1 in {"Open"},
        CALCULATE(
            COUNTROWS('fct_Date Table'),
            DATESBETWEEN('fct_Date Table'[Date], max('Main'[SubmittedDate]), TODAY() - 1),
            'fct_Date Table'[IsWorkingDay] = TRUE,'Main'[Status] IN {"Open"},
            ALL('Main')),
            "NA"
        )

        Tuesday, 17 June 2025

        Creating Date Table in Power Bi

        Date_Table = ADDCOLUMNS(
        CALENDAR(DATE(2023,6,1)
        ,TODAY()),
        "Month-Year",FORMAT([Date],"mmm")&"-"&YEAR([Date]),
        "Month",FORMAT([Date],"mmm"),
        "MonthNum",FORMAT(MONTH([Date]),"00"),
        "Week-Year","Week-" &WEEKNUM([Date],2)&"-"&YEAR([Date]),
        "Year",YEAR([Date]),
        "YearMonth", YEAR([Date]) & FORMAT(MONTH([Date]), "00"),
        "IsWorkingDay",NOT WEEKDAY( [Date] ) IN { 1,7 }
        )

        Calculating Working Days in Power Bi DAX

        References :

        https://dax.guide/weekday/

         Step-1:

        Create a calculated column in Date table.

        "IsWorkingDay",NOT WEEKDAY( [Date] ) IN { 1,7 }


        Step-2: Workingdays to Close

        Working_Days_to_Close =
        CALCULATE(
            COUNTROWS('fct_Date Table'),
            DATESBETWEEN('fct_Date Table'[Date], max('RefTable'[SubmittedDate]), max('RefTable'[ClosedDate]) - 1),
            'fct_Date Table'[IsWorkingDay] = TRUE,
            ALL('RefTable')
        )


        Step-3: Days to Close

        Days to Close =
        var submitdate=max('RefTable'[SubmittedDate])
        var closeddate=max('RefTable'[ClosedDate])
        RETURN CALCULATE(DATEDIFF(submitdate,closeddate,DAY),ALL('fct_Date Table'))


        • ALL Function-> This function removes any filters that might be applied to the 'RefTable'. It ensures that the calculation considers all rows in the 'RefTable', regardless of any existing filters.