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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
AleGuty04
Frequent Visitor

Is there a way to make DAX based of a value in a visual card?

Hello everyone;

I'm trying to build a DAX formula in which I can calculate the fines (if, ot: [types of fines]) by month wether I select week 20 or week 21 I should be able to still see the calculations per month. My data in the fact table is currently set up for calendar weeks and its joined to a date dim table in which it has the months corresponding per week called Month Year:

AleGuty04_0-1691616065870.png


Here's the current DAX formula i'm using:

 

IF Fines Monthly Dax = 
    CALCULATE(
        var table1=
            SUMMARIZE(
                'OTIF Customer Vendor',
                'OTIF Customer Vendor'[customer_vendor_num],
                "calc",
                    IF([Montlhy IF % DAX] >= .98, 0, CALCULATE(SUM('OTIF'[if_fines]))))
        return 
            CALCULATE(SUMX(table1,[calc]))
    , ALL('OTIF'[calendar_week]))

 

Everything works just fine, except for the last calculate function in which I have to add a second slicer for the month to make it work, but ideally its to have it work just with the calendar_week slicer doing the calculation per month :

AleGuty04_1-1691616863748.png

Do you have any ideas in how to do that?

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

Hi @AleGuty04 ,

Please have a try.

IF Fines Monthly Dax =
CALCULATE (
    VAR table1 =
        SUMMARIZE (
            'OTIF Customer Vendor',
            'OTIF Customer Vendor'[customer_vendor_num],
            'Date Dim'[Month Year],
            "calc", IF ( [Montlhy IF % DAX] >= .98, 0, CALCULATE ( SUM ( 'OTIF'[if_fines] ) ) )
        )
    RETURN
        CALCULATE ( SUMX ( table1, [calc] ), ALL ( 'Date Dim'[Month Year] ) ),
    ALL ( 'OTIF'[calendar_week] )
)

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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-rongtiep-msft
Community Support
Community Support

Hi @AleGuty04 ,

Please have a try.

IF Fines Monthly Dax =
CALCULATE (
    VAR table1 =
        SUMMARIZE (
            'OTIF Customer Vendor',
            'OTIF Customer Vendor'[customer_vendor_num],
            'Date Dim'[Month Year],
            "calc", IF ( [Montlhy IF % DAX] >= .98, 0, CALCULATE ( SUM ( 'OTIF'[if_fines] ) ) )
        )
    RETURN
        CALCULATE ( SUMX ( table1, [calc] ), ALL ( 'Date Dim'[Month Year] ) ),
    ALL ( 'OTIF'[calendar_week] )
)

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.