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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Orstenpowers
Post Patron
Post Patron

HASONEVALUE and SWITCH in combination with SAMEPERIODLASTYEAR

Dear all,

 

The measure hereinafter works perfectly fine, but now I need to combine with SAMEPERIODLASTYEAR...and that does not work unfortunately.

Does anybody have an idea how to manage this?

 

Measure Selected =
IF(
    HASONEVALUE('Measure Table'[Measure]),
        SWITCH(
            VALUES('Measure Table'[Measure]),
                "Sales Order Net Amount EUR",SUM(SALES_DATA[F GC / Sales Order Net Amount]),
                "Sales Order Quantity",SUM(SALES_DATA[F / Quantity]),
                "Sales Order Net Amount Local",SUM(SALES_DATA[F LC / Sales Order Net Amount (Local)])
                      ,SUM(SALES_DATA[F GC / Sales Order Net Amount])))
 
For current years' YTD figures I used the following formula.
 
IF(
    ISFILTERED('Date Table (Ref Transaction Date)'[Date]),
    ERROR("Quickmeasures mit Zeitintelligenz können nur über die von Power BI bereitgestellte Datumshierarchie oder die primäre Datumsspalte gruppiert oder gefiltert werden."),
    TOTALYTD(
        [Measure Selected],
        'Date Table (Ref Transaction Date)'[Date].[Date]
    ))
 
Looking forward to receiving your proposals I remain
 
OrstenPowers
1 REPLY 1
Anonymous
Not applicable

Hi @Orstenpowers ,
Can you provide more information in conjunction with the measure you have given, such as providing some sample data (without sensitive information) and your desired output, so that we can better understand and solve the problem you are experiencing.

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors