Forum Discussion

Orstenpowers's avatar
Orstenpowers
Icon for Post Patron rankPost Patron
2 years ago

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

  • Anonymous's avatar
    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.